Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/234.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android设备上的WebView内容(网站)太大_Android_Webview - Fatal编程技术网

Android设备上的WebView内容(网站)太大

Android设备上的WebView内容(网站)太大,android,webview,Android,Webview,我用webview包装了一个Android应用程序。在Android模拟器中,我可以滚动出网站,直到它与webview匹配。但是在一个真正的Android设备上,在网站内容与Webwiw匹配之前,我无法滚动,因为它太大了。为了使网站与webview相匹配,我必须放置/更改什么co 我希望你能理解我的问题并能帮助我 this.mWebView.getSettings().setJavaScriptEnabled(true); this.mWebView.getSet

我用webview包装了一个Android应用程序。在Android模拟器中,我可以滚动出网站,直到它与webview匹配。但是在一个真正的Android设备上,在网站内容与Webwiw匹配之前,我无法滚动,因为它太大了。为了使网站与webview相匹配,我必须放置/更改什么co

我希望你能理解我的问题并能帮助我

        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>


非常感谢您的回答。在MainFragment.java中添加这个?你能发布你的代码吗,在web视图初始化后提到那些设置哪个文件?MainFragment.java?AndroidManifest.xml…?片段和布局文件删除答案并用代码更新问题
<?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>