动作条选项卡 - 固定和滚动?选项卡、动作

2023-09-12 02:27:27 作者:浅溪

在 Android的设计指南它说的有两种类型的标签:固定式和滚动的的

我找不到动作条文档中的任何文件的支持能力指定任一类型的标签。

I can't find any documentation in the ActionBar documentation to support the ability to specify either type of tabs.

如何指定一个标签组是固定的或滚动?如果不能,有什么治选项卡是否固定或可滚动的是什么呢?

How do you specify a tab group to be fixed or scrollable? If you can't, what governs whether the tabs are fixed or scrollable exactly?

推荐答案

选项卡的数量决定了标签组是固定的还是滚动。例如,如果你有一个标签,他们将是固定的,但如果你有一个像6那么他们就会成为可滚动因为所有六个无法容纳在一个屏幕上。

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.

如果你想看到它在行动pre-3.0的设备上,下载操作栏福尔摩斯样本并从主列表中选择功能切换,然后选择标签作为您的导航模式。现在,您可以添加标签到酒吧,起初,他们会变得越来越小补习班他们都在,然后,一旦你有足够的,你可以通过它们滚动。

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.