簡體   English   中英

Android設備上的WebView內容(網站)較大

[英]WebView content (website) at Android device to large

我用webview創建了一個Android應用。 在Android模擬器中,我可以滾動瀏覽網站,直到匹配到Webview。 但是在真正的Android設備上,我無法滾動瀏覽,直到網站內容與webwiew匹配為止。 為了使網站與Webview匹配,我必須進行什么更改?

希望您能理解我的問題,並能對我有所幫助!?

        this.mWebView.getSettings().setJavaScriptEnabled(true);
        this.mWebView.getSettings().setUseWideViewPort(true);
        this.mWebView.getSettings().setLoadWithOverviewMode(true);
        this.mWebView.getSettings().setRenderPriority(RenderPriority.HIGH);

如果您提到上述設置,則webview可以正確呈現您的網站。

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:webviewapp="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <LinearLayout
        android:id="@+id/container_content"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

        <android.support.v4.widget.SwipeRefreshLayout
            android:id="@+id/container_swipe_refresh"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1">

            <WebView
                android:id="@+id/fragment_main_webview"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:background="@color/global_bg_front" />

        </android.support.v4.widget.SwipeRefreshLayout>

        <com.google.android.gms.ads.AdView
            android:id="@+id/fragment_main_adview"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            webviewapp:adUnitId="@string/admob_unit_id"
            webviewapp:adSize="BANNER" />

    </LinearLayout>

    <include layout="@layout/placeholder_progress"
        android:id="@+id/container_progress"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:visibility="gone" />

    <include layout="@layout/placeholder_offline"
        android:id="@+id/container_offline"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:visibility="gone" />

    <include layout="@layout/placeholder_empty"
        android:id="@+id/container_empty"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:visibility="gone" />

</FrameLayout>
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:webviewapp="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <LinearLayout
        android:id="@+id/container_content"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

        <android.support.v4.widget.SwipeRefreshLayout
            android:id="@+id/container_swipe_refresh"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1">

            <WebView
                android:id="@+id/fragment_main_webview"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:background="@color/global_bg_front" />

        </android.support.v4.widget.SwipeRefreshLayout>

        <com.google.android.gms.ads.AdView
            android:id="@+id/fragment_main_adview"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            webviewapp:adUnitId="@string/admob_unit_id"
            webviewapp:adSize="BANNER" />

    </LinearLayout>

    <include layout="@layout/placeholder_progress"
        android:id="@+id/container_progress"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:visibility="gone" />

    <include layout="@layout/placeholder_offline"
        android:id="@+id/container_offline"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:visibility="gone" />

    <include layout="@layout/placeholder_empty"
        android:id="@+id/container_empty"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:visibility="gone" />

</FrameLayout>









<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/activity_main_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <FrameLayout
        android:id="@+id/activity_main_container"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

    <ListView
        android:id="@+id/activity_main_drawer"
        android:layout_width="@dimen/drawer_width"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:choiceMode="singleChoice"
        android:drawSelectorOnTop="false"
        android:fastScrollEnabled="false"
        android:dividerHeight="@dimen/drawer_item_divider"
        android:divider="@color/drawer_item_divider"
        android:cacheColorHint="@android:color/transparent"
        android:listSelector="@android:color/transparent"
        android:background="@color/drawer_bg" />

</android.support.v4.widget.DrawerLayout>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM