菜单选项键开不出现 - 机器人 [英] menu option key does't appear - android
问题描述
我是初学者,我写这些codeS的选项菜单中,但在新的手机一样Nexus4菜单选项键不会出现(它应该出现在后退键在屏幕的底部)。
我的codeS:
@覆盖
公共布尔onCreateOptionsMenu(菜单菜单){
MenuInflater吹气= getMenuInflater();
inflater.inflate(R.menu.menu,菜单);
返回true;
}
和
@覆盖
公共布尔onOptionsItemSelected(菜单项项){
开关(item.getItemId()){
案例R.id.menu1:
menu1_action();
返回false;
默认:
返回super.onOptionsItemSelected(项目);
}
}
和
<?XML版本=1.0编码=UTF-8&GT?;
<项目
机器人:ID =@ + ID / MENU1
机器人:图标=@绘制/ MENU1
机器人:showAsAction =ifRoom
机器人:标题=@字符串/菜单1/>
什么问题?
但在新手机一样Nexus4菜单选项键不会出现(它应该出现在后退键在屏幕底部)
块引用>在理想情况下,它不会。理想情况下,这将是一个...按钮,在操作栏中,对于喜欢的Nexus 4,缺乏离屏菜单按钮的设备:
请参阅告别菜单按钮了解更多信息。
I am beginner , i wrote these codes for option menu , but in new Phones like Nexus4 menu option key does not appear (it should appear near back key on bottom of screen).
my codes :
@Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.menu, menu); return true; }
and
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.menu1: menu1_action(); return false; default: return super.onOptionsItemSelected(item); } }
and
<?xml version="1.0" encoding="utf-8"?>
<item android:id="@+id/menu1" android:icon="@drawable/menu1 android:showAsAction="ifRoom" android:title="@string/menu1"/>
what's the problem?
解决方案but in new Phones like Nexus4 menu option key does not appear (it should appear near back key on bottom of screen)
Ideally, it will not. Ideally, it will be a "..." button in the action bar, for devices like the Nexus 4 that lack an off-screen MENU button:
See Say Goodbye to the Menu Button for more details.
这篇关于菜单选项键开不出现 - 机器人的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!