How to enable horizontal scroll in tab like Google Play?

后端 未结 3 1834
逝去的感伤
逝去的感伤 2020-12-29 18:10

I\'m referencing a great demo here regarding material design. It has tabs, but when I add too many the tab items get squished (see screenshot). How can I make it scroll hori

相关标签:
3条回答
  • 2020-12-29 18:35

    SlidingTabLayout and SlidingTabStrip classes is what are you looking for You need to copy these classes from google developers site, add sliding tab layout in xml, and in set viewpager for sliding tab layout in java. Hope it'll help.

    0 讨论(0)
  • 2020-12-29 18:55

    You can add this app:tabMode="scrollable" to your android.support.design.widget.TabLayout

    0 讨论(0)
  • 2020-12-29 18:57

    TabLayout has a method setTabMode() which can be either MODE_FIXED (default) or MODE_SCROLLABLE which is what you need.

    You can also define this in XML with app:tabMode="scrollable".

    0 讨论(0)
提交回复
热议问题