我正在尝试在Android中创建一个选项菜单,就像这个链接所示:
http://developer.android.com/guide/topics/ui/menus.html#options-menu但是我的菜单显示在顶部操作栏而不是页面底部。
我的XML如下:my_options_menu.xml
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/new_game"
android:icon="@drawable/menu_addnew"
android:title="Νέο"
android:showAsAction="ifRoom"/>
<item android:id="@+id/help"
android:icon="@drawable/menu_addnew"
android:title="Βοήθεια" />
</menu>
我的Java代码是
@Override
public boolean onCreateOptionsMenu(Menu menu){
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.my_options_menu, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle item selection
switch (item.getItemId()) {
case R.id.new_game:
//newGame();
return true;
case R.id.help:
//showHelp();
return true;
default:
return super.onOptionsItemSelected(item);
}
}
我该如何将菜单显示在我的应用程序底部而不是顶部操作栏上?
我的菜单显示如下图所示:
![enter image description here](https://istack.dev59.com/hi4Zt.webp)
![enter image description here](https://istack.dev59.com/U6h38.webp)