ScrollView Inside ViewPager Not Working

前端 未结 1 523
生来不讨喜
生来不讨喜 2021-01-03 01:16

i have an activity ViewPager and which have Tabbed Childs. The childs with recycler View do Scroll. Although When i create a simple fragment with scroll view it does not wor

相关标签:
1条回答
  • 2021-01-03 01:43

    I managed to solve a similar vertical scrolling problem in my ViewPager doing the following:

    1. I created a separate layout (content_event) with ViewPager:

      <RelativeLayout
          xmlns:android="http://schemas.android.com/apk/res/android"
          xmlns:app="http://schemas.android.com/apk/res-auto"
          android:orientation="vertical"
          android:layout_width="match_parent"
          android:layout_height="match_parent">
      
      <android.support.v4.view.ViewPager
          android:id="@+id/viewPagerActivEvent"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          app:layout_behavior="@string/appbar_scrolling_view_behavior">
      
      </android.support.v4.view.ViewPager>
      
      </RelativeLayout>
      
    2. And created NestedScrollView enclosing preceding layout with "android:fillViewport" set to true:

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

    Maybe it's not quite right but worked for me:)

    0 讨论(0)
提交回复
热议问题