Android 嵌套ScrollView中的webview导致高度问题

Android 嵌套ScrollView中的webview导致高度问题,android,webview,android-coordinatorlayout,coordinator-layout,nestedscrollview,Android,Webview,Android Coordinatorlayout,Coordinator Layout,Nestedscrollview,我使用support.v4.widget.NestedScrollView,我的webview有问题 以下是我的布局: <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/coordinato

我使用support.v4.widget.NestedScrollView,我的webview有问题

以下是我的布局:

<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/coordinatorLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:focusableInTouchMode="true">

<android.support.design.widget.AppBarLayout
    android:layout_width="match_parent"
    android:layout_height="?attr/actionBarSize"
    android:id="@+id/barlayout">

    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:background="#9E9E9E"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_scrollFlags="scroll|enterAlways">

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:id="@+id/relativeLayout"
            android:animateLayoutChanges="true">

            <!-- some views here -->

        </RelativeLayout>

    </android.support.v7.widget.Toolbar>

</android.support.design.widget.AppBarLayout>

<android.support.v4.widget.NestedScrollView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:layout_behavior="@string/appbar_scrolling_view_behavior">

    <WebView
        android:id="@+id/webView"
        android:layout_height="match_parent"
        android:layout_width="match_parent" />

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

<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <ProgressBar
        style="?android:attr/progressBarStyleHorizontal"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/progressBar"
        android:layout_alignParentTop="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:layout_alignParentRight="true"
        android:layout_alignParentEnd="true"/>

    <include
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        layout="@layout/dialog_location"
        android:id="@+id/dialog"
        android:visibility="invisible"
        android:layout_alignParentBottom="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true" />

</RelativeLayout>

如果我将webview更改为包装内容,则webview很小

<WebView
        android:id="@+id/webView"
        android:layout_height="wrap_content"
        android:layout_width="match_parent" />


我们正在做完全相同的事情。这已经被谷歌的开发者和设计师们试用过了。目前提供的解决方案是在NestedScrollView中不使用Android WebView

以下是这篇文章的摘录:

我是伟

如果将webview放在NestedScrollView中,则高度为wrap\u contents,并且 webview将扩展到页面的大小。这就像在桌面上一样, 您可以根据页面的高度调整浏览器窗口的大小,使其无法滚动 垂直地滚动发生在NestedScrollView中,而不是 webview本身

因此,由于页面中没有js,因此会看到任何滚动事件,因此 不知道你已经滚动到页面末尾加载更多内容

此外,硬件层由GL纹理支持,并且它们具有最大 大小(最小屏幕大小,但通常不太大) 更大)。如果视图变得大于最大纹理大小,则 它不适用于硬件层。这适用于任何视图,而不是 只是网络视图

解决方案:不要将webview放在NestedScrollView中。不要使用webview 在包装内容模式下。让webview滚动网页本身