1

の中にNestedSCrollViewがあります。 NestedSCrollViewにはViewPagerがあります。私はそれにWebViewを含むフラグメントビューを入れました。問題は、WebViewのテキストが非常に長い場合、切り詰められ、スクロールできないということです。これを解決するには?NestedSCrollViewはCoordinatorLayoutで完全にスクロールしません

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

これは、フラグメントxmlです:

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

problem

答えて

0

問題はViewPagerwrap_contentをサポートしていないということです。だからそれは正確でなければならないかmatch parentです。

もう1つの解決方法は、のOnMeasureメソッドをオーバーライドすることです。このanswerをチェックしてください。

関連する問題