java ActionBar按钮不显示
我试图在操作栏中显示我的菜单,如下所示:
<menu xmlns:安卓="http://schemas.安卓.com/apk/res/安卓" >
<item
安卓:id="@+id/Menu1"
安卓:icon="@drawable/res1"
安卓:showAsAction="ifRoom"
安卓:title="Menu1"/>
<item
安卓:id="@+id/Menu2"
安卓:icon="@drawable/res2"
安卓:showAsAction="ifRoom"
安卓:title="Menu2"/>
<item
安卓:id="@+id/Menu3"
安卓:icon="@drawable/res3"
安卓:showAsAction="ifRoom"
安卓:title="Menu3"/>
</menu>
在代码中:
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_logged, menu);
return true;
}
在设计编辑器上,会显示这些按钮。但当我在智能手机(三星Galaxy Note 3)上启动应用程序时,里面的菜单会显示3个点。但操作栏中没有菜单
我不明白,我测试了安卓:showAsAction
的所有标志,但我仍然有菜单中的3个点
谢谢你的帮助
# 1 楼答案
试试这个
# 2 楼答案
试试下面的菜单。xml