动作条堆叠标签栏不填父 [英] Stacked ActionBar tab bar not filling parent
问题描述
我要创建动作栏导航标签,但是当操作栏堆叠标签没有得到整个宽度的空间。我有一个照片来说明吧。
I'm creating Action Bar navigation tabs, but when the Action Bar is stacked the tabs are not getting the whole width space. I have a foto to illustrate it.
是可能的,在这种情况下,给在屏幕宽度与每个选项卡50%?
Is possible, in this case, giving to each tab 50% of the screen width?
感谢您
我的编辑说,这不是一个福尔摩斯操作栏。而且我工作在一个三星Galaxy Note 10.1和一台Nexus 7,而现在,测试它在Nexus,我注意到,它的行为是不同的。另一张截图:
I'm editing to say that it's not a Sherlock Action Bar. And I'm working in a Samsung Galaxy Note 10.1 and in a Nexus 7. And now, testing it in the Nexus, I noticed that it's behaviour is different. Another screenshot:
推荐答案
我不认为这是目前可行的。我一直在试图做同样的事情,在过去几天,这里是我到目前为止发现。
I don't think that's feasible at the moment. I've been trying to do the same thing for the past few days, and here's what I have found so far.
Android框架使用一类称为ActionBarPolicy设置有关动作条的行为的一些规则。 在这个文件中(可以在这里找到:<一href="https://github.com/android/platform_frameworks_base/blob/master/core/java/com/android/internal/view/ActionBarPolicy.java">https://github.com/android/platform_frameworks_base/blob/master/core/java/com/android/internal/view/ActionBarPolicy.java),你会发现)呼吁getStackedTabMaxWidth(一个方法,它返回一个扪值(在ressources在160dip当前设定)。
The Android framework uses a class called ActionBarPolicy to set some rules regarding the ActionBar's behavior. In this file (which can be found here : https://github.com/android/platform_frameworks_base/blob/master/core/java/com/android/internal/view/ActionBarPolicy.java), you'll find a method called getStackedTabMaxWidth() which returns a dimen value (currently set in the ressources at 160dip).
此值采用的是内部类TabView的放在ScrollingTabContainerView(<一href="https://github.com/android/platform_frameworks_base/blob/master/core/java/com/android/internal/widget/ScrollingTabContainerView.java">https://github.com/android/platform_frameworks_base/blob/master/core/java/com/android/internal/widget/ScrollingTabContainerView.java). TabView的是私有实现的动作条的TabBar的。
This value is used is the inner class TabView placed in ScrollingTabContainerView (https://github.com/android/platform_frameworks_base/blob/master/core/java/com/android/internal/widget/ScrollingTabContainerView.java). TabView is the private implementation of the ActionBar's TabBar.
现在,我不认为这个值,也不该行为可能除了使用反射进行修改。我不知道有足够的了解它这样做,因此,如果有人能处理这样的事情,不要犹豫,这么说,因为这真的是一个坏的行为看起来并不大的一些平板电脑。
Now I don't think this value nor this behavior can be modified, except maybe using Reflection. I don't know enough about it to do so, so if someone could manage such a thing, don't hesitate to say so, because this really is a bad behavior which doesn't look great on some tablets.
这篇关于动作条堆叠标签栏不填父的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!