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"
/>