How do I fix the indicator of TabLayout to the center of the screen like Google's news app?By default, the indicator moves to match the tab, but I want the indicator to be fixed in the middle so that the tab scrolls accordingly.
xml
app:tabMode="scrollable"
app:tabContentStart="72dp"
I can do something like that in , but is there a solution for this: when the tab scrolls to the end to match ViewPager, the tab stops scrolling and the indicator starts to move instead (sorry, it's hard to explain in writing)?
android android-layout
TabLayout
seems difficult to achieve.
This is an introduction to the library, but if you use the Always In Center
of this library, you will be able to achieve the desired behavior.
https://github.com/ogaclejapan/SmartTabLayout
Also, if you want to use Google Newsstand-style layout, this library is convenient.
Of course, you can also specify the center of the tab.
https://github.com/florent37/MaterialViewPager
© 2024 OneMinuteCode. All rights reserved.