如何强制分拆动作条的标签和标题/主页/菜单?分拆、菜单、动作、标签

2023-09-06 03:18:54 作者:心有不甘.

我用动作条的有 PageViewer ,但遇到一个问题,标签功能。在我的Nexus 7,标签显示是这样的:

I'm using ActionBar's tab feature with a PageViewer, but meet a problem. On my Nexus 7, the tabs show like this:

您可以看到标题因缺少空间切割。但在HTC Incredible S的采用Android 4.0它表明这样的:

You can see the title is cut due to lacking space. But on HTC Incredible S with Android 4.0 it shows like:

这就是我想要的。我在factr想要的标签栏来虽然放置在屏幕的底部,但分裂为两行无论在顶部是可以接受的。

And this is what I want. I in factr want the tab bar be placed on bottom of screen though, but splitting to two rows and both on top is acceptable.

有谁知道怎么也拆标签栏强制应用程序在Nexus 7到另一行?谢谢!

Does anyone know how to force app on Nexus 7 also split tab bar to another row? Thank you!

推荐答案

AFAIK,操作栏单独决定是否将在第二排的标签,我们不能影响到这一点。

AFAIK, the action bar alone decides whether or not to put the tabs on a second row, and we cannot influence that.

另外,请记住,在很多情况下,你的标签将不会出现在所有的,由一个下拉列表取代 - 基本上,Android的转换标签导航,列出导航

Also, bear in mind that in many cases, your tabs will not appear at all, replaced by a drop-down list -- basically, Android converts tab navigation to list navigation.

如果你想确保你的标签始终标签,并始终低于操作栏,操作栏中移除标签,并切换到使用 ViewPager 的你的内容,与任何 PagerTabStrip (从Android支持包,其中 ViewPager 来自)或从该选项卡指示器 ViewPagerIndicator 项目为标签本身。作为一个附带的好处是,你的内容是现在的水平滑动,能够在标签之间移动,这是一个普遍的做法现在。

If you want to ensure that your tabs are always tabs, and are always below the action bar, remove the tabs from the action bar and switch to using a ViewPager for your content, with either PagerTabStrip (from the Android Support package, where ViewPager comes from) or the tab indicator from the ViewPagerIndicator project for the tabs themselves. As a side benefit, your contents are now horizontally swipe-able to move between tabs, which is a popular approach nowadays.

我在factr要在标签栏放在屏幕的底部,虽然

I in factr want the tab bar be placed on bottom of screen though

请记住,这违反了Android的设计准则:http://developer.android.com/design/patterns/pure-android.html

Please bear in mind that this violates the Android Design guidelines: http://developer.android.com/design/patterns/pure-android.html