Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typescript/9.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/bash/18.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 NestedSCrollView未在CoordinatorLayout中完全滚动_Android_Android Viewpager_Android Coordinatorlayout_Android Nestedscrollview - Fatal编程技术网

Android NestedSCrollView未在CoordinatorLayout中完全滚动

Android NestedSCrollView未在CoordinatorLayout中完全滚动,android,android-viewpager,android-coordinatorlayout,android-nestedscrollview,Android,Android Viewpager,Android Coordinatorlayout,Android Nestedscrollview,我有一个NestedSCrollView内部CoordinatorLayout。在NestedSCrollView中有一个ViewPager。我在其中放置了一个片段视图,其中包含WebView。问题是如果WebView中的文本很长,就会被剪切,我无法滚动。如何解决这个问题 <android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android" xml

我有一个
NestedSCrollView
内部
CoordinatorLayout
。在
NestedSCrollView
中有一个
ViewPager
。我在其中放置了一个片段视图,其中包含
WebView
。问题是如果
WebView
中的文本很长,就会被剪切,我无法滚动。如何解决这个问题

<android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/nest_scrollview"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fillViewport="true"
    app:layout_behavior="@string/appbar_scrolling_view_behavior">

    <LinearLayout

        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        >

        <android.support.design.widget.TabLayout
            android:id="@+id/tabs"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:tabMode="scrollable"
            app:tabGravity="fill"/>

        <android.support.v4.view.ViewPager
            android:id="@+id/viewpager"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:layout_behavior="@string/appbar_scrolling_view_behavior"  />


    </LinearLayout>

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

问题在于
ViewPager
不支持
包装内容。因此,它必须精确或与父项匹配

另一个解决方案是覆盖
ViewPager
OnMeasure
方法。看看这个

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
>

<WebView
android:id="@+id/appearance"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="5dp"
    />