I am using CollapsingBarLayout with viewpager and the fragments of viewpager are having listview, gridview.
Here is my code:
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"