MenuItem的setAsAction四种属性解析

来源:互联网 发布:linux c 搭建服务器 编辑:程序博客网 时间:2024/05/06 04:14

ifRoom

Only place this item in the app bar if there is room for it. If there is not room for all the items marked "ifRoom", the items with the lowest orderInCategory values are displayed as actions, and the remaining items are displayed in the overflow menu.

仅当app bar有足够位置时添加到上面,若没有足够的位置放置所有的设置成ifRoom的项,则拥有最小orderInCategory 值得子项被放置到app bar上面,其他的作为菜单进行显示

withText

Also include the title text (defined by android:title) with the action item. You can include this value along with one of the others as a flag set, by separating them with a pipe |.

将该项显示在app bar上面并显示其中的标题文本,你可以将这个与其他三个一起使用,用|分隔

never

Never place this item in the app bar. Instead, list the item in the app bar's overflow menu.

不将这个item放置到app bar上面,只是将其作为菜单

always

Always place this item in the app bar. Avoid using this unless it's critical that the item always appear in the action bar. Setting multiple items to always appear as action items can result in them overlapping with other UI in the app bar.

总是将其显示在app bar上面,除非该item非常重要否则不要设置此选项,将多个item设置成此选项将导致其与其他app bar上面的UI想覆盖

collapseActionView

The action view associated with this action item (as declared by android:actionLayout or android:actionViewClass) is collapsible.

将其折叠成普通菜单项进行显示
Introduced in API Level 14.

API 14被引用

2 0
原创粉丝点击