如何以编程方式控制动作条分割? [英] How to control ActionBar split programmatically?

查看:187
本文介绍了如何以编程方式控制动作条分割?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Android 动作条可以分成顶部和底部的酒吧,如果活动的参数 uiOptions 设置为 splitActionBarWhenNarrow ,注意,这个参数仅在ICS中有效。

The android ActionBar may split into a top and bottom bars if activity's parameter "uiOptions" is set to "splitActionBarWhenNarrow", note this parameter is only valid in ICS.

蜂窝推出了一种新的方法来使用操作栏多选择列表项。当一个产品在preSS和放大器;保存列表变成为一个多选择模式和动作条杆可被用于完成某些动作。该动作条设置从列表中的活动,即继承,如果活动有一个拆分操作栏上的多选会有太大了,如果该活动只有最上面一栏,因此,多选择将符合这一点。

Honeycomb has introduced a new approach to multi-select list items using action bar. When a item is under press & hold the list becomes into a multi-selection mode and the actionbar bar may be used to accomplish some actions. The actionbar setup is inherited from the list activity, i.e., if the activity has a split action bar the multi-selection will have too, and if the activity has only the top bar, so, the multi-selection will be compliant with that.

现在的问题是,是否有可能只在活动一顶操作栏,并在列表中变成多选模式编程拆分动作条?

The question is, is it possible to have only a top action bar in the activity and when the list turns into multi-selection mode programmatically split the actionbar?

谢谢!

推荐答案

没有,你不能分裂,非分裂操作栏上飞之间进行切换。

No, you cannot switch between split and non-split action bars on the fly.

在二传手对口安卓uiOptions 窗口,不是活动。 <一href="http://developer.android.com/reference/android/view/Window.html#setUiOptions%28int,%20int%29"><$c$c>Window#setUiOptions是该方法,并使用该标志被<一href="http://developer.android.com/reference/android/content/pm/ActivityInfo.html#UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW"><$c$c>ActivityInfo#UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW.

The setter counterpart to android:uiOptions is on Window, not Activity. Window#setUiOptions is the method and the flag to use is ActivityInfo#UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW.

然而,这是不会做你想做的。当窄必须被指定为窗口拆分操作栏是第一次配置窗口的装饰初始化之前。换句话说,一旦窗口已显示出来(甚至一旦你叫的setContentView )为时已晚去改变它。

However this isn't going to do what you want. Split action bar when narrow must be specified as the window is first configured before the window decor is initialized. In other words, once the window has been displayed (or even once you've called setContentView) it's too late to change it.

这是由Android的UX团队有意识的决定。动作模式(包括选择方式)意在反映对当前活动的操作杆的配置。这为用户提供了一个单一的地方去寻找相同活动中当前有效的行动。

This was a conscious decision by the Android UX team. Action modes (including selection modes) are meant to mirror the configuration of the action bar on the current activity. This gives the user a single place to look for currently valid actions within the same activity.

这篇关于如何以编程方式控制动作条分割?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆