Viewpager not appearing when using CollapsingToolbarLayout

后端 未结 1 1315
青春惊慌失措
青春惊慌失措 2021-01-12 17:01

I\'ve been playing around with the Design Support Library and have come across a little problem that I hope someone can help me out with.

I\'m using a CollapsingTool

相关标签:
1条回答
  • 2021-01-12 17:29

    You should remove the NestedScrollView and LinearLayout levels between your CoordinatorLayout and ViewPager:

    <android.support.design.widget.CoordinatorLayout>
      <android.support.design.widget.AppBarLayout>
          ...
      </android.support.design.widget.AppBarLayout>
    
      <android.support.v4.view.ViewPager
        android:id="@+id/viewpager"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@android:color/white"
        app:layout_behavior="@string/appbar_scrolling_view_behavior" />
    
    </android.support.design.widget.CoordinatorLayout>
    

    The view with app:layout_behavior="@string/appbar_scrolling_view_behavior must be a direct child of CoordinatorLayout to be positioned correctly in relation to the AppBarLayout.

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