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
.
ViewPager2
based on RecyclerView
and implement only a limited subset of old ViewPager
features.
Currently you cannot properly use neither PagerTitleStrip
nor PagerTabStrip
with ViewPager2
.
Frankly I don't even know usecase where TabLayout
with custom themed tabs and indicator and, maybe, some little extra code won't suffice.
Thus the only solution for ViewPager2
as for now is to use TabLayout
.
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.
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.
© 2022 - 2024 — McMap. All rights reserved.