How to hide toolbar in ViewPager when using Scrolling RecyclerView?

I have a toolbar in a pager view (tabbed panel with horizontal navigation for navigation), and each tab has its own fragment with recyler_view. Now I want to hide the toolbar when the recyler_view scroll scrolls. In my snippet, I added to scroll-listener and want to call there a method in my activity class to hide the toolbar. A toolbar is created in action. How can I call this method from my fragment? or it would be better to implement this hiding method in my fragment itself. But then, how can I β€œcontact” my toolbar, which is created in action, not in a fragment. I found solutions, but none of them speaks of recyccer_view in fragment and view-pager for tabbed navigation. It would be great if you could help me ...

+6
source share
1 answer

I had the same problem as yours and solved it using the ObservableScrollView library.

Take a look at ViewPagerTabRecyclerViewFragment .

If you do not want to use the library, you can still see how they implemented it, since lib is Open Source

+1
source

Source: https://habr.com/ru/post/981657/


All Articles