I have a standard implementation of PagerTitleStrip in ViewPager but it cannot work in ViewPager2. If I want to migrate to ViewPager2, how should I implement PagerTitleStrip within ViewPager2? I found solution and many detailed info regarding how to implement PagerTabStrip behaviour using TabLayout but it is not applicable to PagerTitleStrip.
How to use PagerTitleStrip in ViewPager2?
742 Views Asked by Neoh At
2
There are 2 best solutions below
0
On
Currently ViewPager2 has many bugs, that should be fix may be in future. while i was working on same i also found a bug and because of that i am unable to use ViewPager2 properly. For now it should be good if you use ViewPager only and avoid to use ViewPager2 for some time. Or the suggestion of Paul Ost is also good and acceptable.
ViewPager2based onRecyclerViewand implement only a limited subset of oldViewPagerfeatures.Currently you cannot properly use neither
PagerTitleStripnorPagerTabStripwithViewPager2.Frankly I don't even know usecase where
TabLayoutwith custom themed tabs and indicator and, maybe, some little extra code won't suffice.Thus the only solution for
ViewPager2as for now is to useTabLayout.Maybe if you will ask a question in context of your usecase or needed design - there will be a more detailed answer.
Hope it helps.