ActionBar Tabs - Fixed and Scrollable?

后端 未结 2 749
感动是毒
感动是毒 2021-02-05 13:02

In the Android Design Guidelines it states that \"There are two types of tabs: fixed and scrollable.\"

I can\'t find any documentation in the ActionBar document

相关标签:
2条回答
  • 2021-02-05 13:21

    It's worth noting that the setting

        android:showAsAction
    

    will also have an effect on how tabs are shown, at least in 4.0+ devices. Setting

            <item name="android:showAsAction">always</item>
    

    as part of a theme will result in all tabs being given equal spacing on the screen, without scrolling, if space is available to do so.

    0 讨论(0)
  • 2021-02-05 13:22

    The number of tabs dictates whether the tab group is fixed or scrollable. For example, if you have one tab, they'll be fixed but if you have like six then they'll become scrollable because all six can't fit on one screen.

    If you want to see it in action on a pre-3.0 device, download the Action Bar Sherlock sample and select Feature Toggles from the main list and then select "Tabs" as your navigation mode. Now you can add tabs to the bar and at first, they'll get smaller to cram them all in and then once you have enough you can scroll through them.

    UPDATE: There is now a page on this in the official documentation that says "Fixed tabs are displayed with equal width, based on the width of the widest tab label. If there is insufficient room to display all tabs, the tab labels themselves will be scrollable." Read more here.

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