溢出没有出现在操作栏了 [英] Overflow not showing up in Action Bar
问题描述
我在5-6的项目我的操作栏。当我设置 ShowAsAction =从不
,该项目进入,而我想在三点阵风格的图标<出现在屏幕底部的旧风格的菜单/ STRONG>出现在操作栏。此外,当我点击它,在菜单不会出现。
我的菜单文件 -
&LT;菜单的xmlns:机器人=http://schemas.android.com/apk/res/android&GT;
&LT;项目
机器人:ID =@ + ID /关于
机器人:标题=关于
机器人:orderInCategory =1
机器人:showAsAction =总是/&GT;
&LT;项目
机器人:ID =@ + ID /设置
机器人:标题=设置
机器人:orderInCategory =2
机器人:showAsAction =总是/&GT;
&LT;项目
机器人:ID =@ + ID /项目3
机器人:标题=项目3
机器人:图标=@可绘制/ ic_launcher
机器人:orderInCategory =3
机器人:showAsAction =总是/&GT;
&LT;项目
机器人:ID =@ + ID / ITEM4
机器人:标题=项目3
机器人:图标=@可绘制/ ic_launcher
机器人:orderInCategory =4
机器人:showAsAction =总是/&GT;
&LT;项目
机器人:ID =@ + ID / item5
机器人:标题=项目3
机器人:图标=@可绘制/ ic_launcher
机器人:orderInCategory =5
机器人:showAsAction =从不/&GT;
&LT;项目
机器人:ID =@ + ID / item6
机器人:标题=项目3
机器人:图标=@可绘制/ ic_launcher
机器人:orderInCategory =6
机器人:showAsAction =从不/&GT;
&LT; /菜单&gt;
如果您有您的设备上的硬盘的菜单按钮,然后不适合上动作条$ C $菜单选项C>将被放置在您的设备的菜单按钮。如果有一个新的设备,而无需该按钮则它们将被放置在溢出菜单(3垂直点)
请参阅创建选项菜单
我创建了一个自定义的布局
为自定义动作条
,这样我可以有相同的排序的外观和功能在所有设备。您可以考虑做同样的事情,如果这是你想要的。
I have 5-6 items in my Action Bar. When I set ShowAsAction = "never"
, the items goes into the old styled menu which appears from bottom of the screen while I want the three dot styled icon to appear on Action Bar. Also when I click on it, the menu doesn't appear.
My menu file -
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="@+id/About"
android:title="About"
android:orderInCategory="1"
android:showAsAction="always"/>
<item
android:id="@+id/Settings"
android:title="settings"
android:orderInCategory="2"
android:showAsAction="always"/>
<item
android:id="@+id/item3"
android:title="Item3"
android:icon="@drawable/ic_launcher"
android:orderInCategory="3"
android:showAsAction="always"/>
<item
android:id="@+id/item4"
android:title="Item3"
android:icon="@drawable/ic_launcher"
android:orderInCategory="4"
android:showAsAction="always"/>
<item
android:id="@+id/item5"
android:title="Item3"
android:icon="@drawable/ic_launcher"
android:orderInCategory="5"
android:showAsAction="never"/>
<item
android:id="@+id/item6"
android:title="Item3"
android:icon="@drawable/ic_launcher"
android:orderInCategory="6"
android:showAsAction="never"/>
</menu>
If you have a hard menu button on your device then the menu options that don't fit on the ActionBar
will be placed on your device's menu button. If you have a newer device without this button then they will be placed in the overflow menu (the 3 vertical dots)
I created a custom layout
for a custom ActionBar
so that I could have the same sort of look and functionality across all devices. You may consider doing the same thing if this is what you want.
这篇关于溢出没有出现在操作栏了的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!