我在5-6的项目我的操作栏。当我设置 ShowAsAction =从不
,该项目进入,而我想在三点阵风格的图标出现在操作栏。此外,当我点击它,在菜单不会出现。
我的菜单文件 -
<菜单的xmlns:机器人=http://schemas.android.com/apk/res/android>
<项目
机器人:ID =@ + ID /关于
机器人:标题=关于
机器人:orderInCategory =1
机器人:showAsAction =总是/>
<项目
机器人:ID =@ + ID /设置
机器人:标题=设置
机器人:orderInCategory =2
机器人:showAsAction =总是/>
<项目
机器人:ID =@ + ID /项目3
机器人:标题=项目3
机器人:图标=@可绘制/ ic_launcher
机器人:orderInCategory =3
机器人:showAsAction =总是/>
<项目
机器人:ID =@ + ID / ITEM4
机器人:标题=项目3
机器人:图标=@可绘制/ ic_launcher
机器人:orderInCategory =4
机器人:showAsAction =总是/>
<项目
机器人:ID =@ + ID / item5
机器人:标题=项目3
机器人:图标=@可绘制/ ic_launcher
机器人:orderInCategory =5
机器人:showAsAction =从不/>
<项目
机器人:ID =@ + ID / item6
机器人:标题=项目3
机器人:图标=@可绘制/ ic_launcher
机器人:orderInCategory =6
机器人:showAsAction =从不/>
< /菜单>
解决方案
如果您有您的设备上的硬盘的菜单按钮,然后不适合上动作条将被放置在您的设备的菜单按钮。如果有一个新的设备,而无需该按钮则它们将被放置在溢出菜单(3垂直点)
![做了个班组工作栏目,在栏目列表和内容也都显示正常,怎么将列表页部分内容提取到首页显示 安装使用交流 PageAdmin CMS网站管理系统官方论坛 Powered by](/d/file/2023/09-17/688205cb402fbb9e7713c9555cf398fd.png)
请参阅创建选项菜单
我创建了一个自定义的布局
为自定义动作条
,这样我可以有相同的排序的外观和功能在所有设备。您可以考虑做同样的事情,如果这是你想要的。
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)
See Creating an Options Menu
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.
相关推荐
最新文章