How to stop ActionBar Tab navigation to display as a spinner when it gets too long?

后端 未结 5 497
忘掉有多难
忘掉有多难 2020-12-09 11:39

i have an action bar with a Tab navigation. While running on 3.1 everything was fine, but once i installed the app on a 4.1 device the tabs where forced to be displayed as a

5条回答
  •  北荒
    北荒 (楼主)
    2020-12-09 11:56

    As I understand you should consider using a ViewPager + PagerTitleStrip if you have many tabs and want to make them scrollable all time. Here is a quote from ttps://code.google.com/p/android/issues/detail?id=24439#c9:

    If your UI contains many tabs to the point where you hit the scrolling tabs or collapse-to-spinner case regularly, you might consider using a PagerTitleStrip as an indicator rather than full tabs to present this info in a less cluttered way. This can be especially useful if the set of tabs displayed is under user control. Clickable tabs work best when there is a small, bounded set such as in the YouTube app. Scrolling tab strips lose one-touch access to any tab, their primary advantage over a simple title strip. Examples of the PagerTitleStrip style can be found in the Android Market and Google+ apps.

    I would not recommend using tricks as nobody guarantee that tricks will works stable.

提交回复
热议问题