Android Toolbar + Tab Layout + Drawer, Hide toolbar when scrolling and take TabLayout to the top

Vishal Pawale picture Vishal Pawale · Nov 30, 2015 · Viewed 12.9k times · Source

I have activity which has drawer attached to it. Each menu of the drawer is a fragment, and under one of the menu I have a fragment with TabLayout, and each tab contains a RecyclerView. So now, when I scroll the RecyclerView, tab layout is getting hidden but ToolBar remains at the top. What I need is to ToolBar to get hidden(scrollFlags:scroll|enterAlways), and TabLayout should get shown at the top.

So current setup is:

Activity with attached DrawerLayout -> Fragment with TabLayout -> Tab Fragment 1 with RecyclerView -> Tab Fragment 2 with RecyclerView

Answer

Vishal Patel picture Vishal Patel · Dec 10, 2015

Less Code More Effective

Hello @Vishal i have found too much for you. because i am also searching this topic before some time.

I have found one brilliant library named MaterialViewPager this is fully customize with what you want to hide in scroll mode.

See the video on https://www.youtube.com/watch?v=r95Tt6AS18c

enter image description here