I have the same desire, a ViewPager inside a NestedScrollView . But for me, this does not work either. In my case, the ViewPager is inside the Fragment , so I can switch the content depending on the interaction with the box. Of course, AppBar, collapse, etc. And all the new support library features should work.
If the user vertically scrolls the page in the pager, I want the other pages to scroll the same way, to give the user a general impression that the pager itself is scrolling.
What I did, what works, is that I no longer insert the ViewPager inside a NestedScrollView , instead I insert the contents of the contained fragments inside the NestedScrollView .
Then, in the case of scrolling in one fragment, I inform the container about the new scroll position that stores it.
Finally, when scrolling left or right on a pager (using addOnPageChangeListener to search for drag states), I inform the target left or right fragment where it should scroll (based on the knowledge of the container), which should be aligned from the fragment from which I came .
François Perret Jun 17 '15 at 21:02 2015-06-17 21:02
source share