Collapsing ToolBar Layout with viewpager

前端 未结 5 1128
旧时难觅i
旧时难觅i 2021-02-02 12:43

I am using CollapsingBarLayout with viewpager and the fragments of viewpager are having listview, gridview.

Here is my code:

    

        
5条回答
  •  南笙
    南笙 (楼主)
    2021-02-02 13:15

    You need put your ViewPager inside AppBar section and setup layout_behavior :

    >
        
         // THIS VIEWS WILL BE COLLAPSED
        
    
        // THIS VIEWS WILL BE PINNED
        
    
        
    
    

    If you using Fragments as children of ViewPager you need setup layout_behavior to each fragment inside ViewPager too.

    app:layout_behavior="@string/appbar_scrolling_view_behavior"
    

提交回复
热议问题