I`m using ViewPager and TabLayout. If tabs can be placed on the display tabMode they must be:
app:tabMode="fixed"
else
app:tabMode="scrollable"
How can I do this?
These methods have a features: always attaching the "tab widget" with a ViewPager , and in order to make this requirement, we must disable swipe feature of the ViewPager . Now, with Material design, we now use TabLayout widget, which can "stand alone" to build a tab bar and do not need a ViewPager anymore.
I din't get your question but i may help you,
if tabs count is static or fixed(you know number of tabs) then app:tabMode="fixed"
if tabs count is dynamic(data coming from feed) then app:tabMode="scrollable"
There are two tabModes we can use with TabLayout:
app:tabMode="fixed"
app:tabMode="scrollable"
and programatically it is like
tabLayout.setTabMode(TabLayout. MODE_FIXED);
tabLayout.setTabMode(TabLayout. MODE_SCROLLABLE);
above is same for MODE_SCROLLABLE
to understand TabLayout modes you can refer below Link https://developer.android.com/reference/android/support/design/widget/TabLayout
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With