android 添加菜单栏,android – 如何在导航栏上添加菜单按钮

我有一个简单的应用程序,只需要一个菜单​​按钮和一些选项,它应该适用于所有设备.

无论如何,我的应用程序在所有情况下都能正常工作,除了我无法在导航栏上放置菜单按钮.

这是我的代码:

values文件夹中的styles.xml

true

styles.xml in value-v11& value-v14文件夹

false

true

@android:style/Widget.Holo.ActionBar

此代码出现在我的活动的所有onCreate事件中

if(Build.VERSION.SDK_INT <= 10 || (Build.VERSION.SDK_INT >= 14 &&

ViewConfiguration.get(this).hasPermanentMenuKey()))

{

// menu key is present

ActionBar actionBar = getActionBar();

if(actionBar!=null)

actionBar.hide();

}

else

{

//No menu key

ActionBar actionBar = getActionBar();

if(actionBar!=null)

actionBar.show();

}

这段代码工作正常,但是如果我没有任何操作栏,我想把菜单按钮放在导航栏中.

我已经做了很多谷歌搜索,但我找不到任何有效的解决方案.

提前致谢.