如果不采取行动栏中使用选项菜单 [英] Use options menu without action bar
本文介绍了如果不采取行动栏中使用选项菜单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我现在用这个隐藏在我的Android应用程序的动作 - /标题栏
I'm am using this to hide the action-/titlebar in my android application
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
我创建了选项菜单与此:
I created my options menu with this:
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.bottom_menu, menu);
return(super.onCreateOptionsMenu(menu));
这是bottom_menu.xml
And this is the bottom_menu.xml
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/refresh"
android:title="Neu laden" />
<item android:id="@+id/settings"
android:title="Einstellungen" />
<item android:id="@+id/logout"
android:title="Ausloggen" />
</menu>
当我preSS菜单键,应用程序崩溃。当我不隐瞒的动作 - /标题栏,一切工作正常。
我已经发现SO这个问题,但我不解决这个问题:隐藏动作条,显示选项菜单
When I press the menu button, the app crashes. When I don't hide the action-/titlebar, everything works fine. I already found this question on SO, but I don't solve the Problem: Hide Actionbar, Show Options Menu
推荐答案
我发现自己的问题,愚蠢的......
I found the problem myself, stupid...
我改了:
public class MainActivity extends ActionBarActivity {
到
public class MainActivity extends Activity {
这篇关于如果不采取行动栏中使用选项菜单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文