我试图将我的应用程序重新设置为使用ABS的ICS外观。获得ActionBar本身很好,直接,但是添加菜单项目还没有。ActionBarSherlock项目没有出现在溢出
我的代码如下所示:
@Override
public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);
MenuInflater inflater = getSupportMenuInflater();
inflater.inflate(R.menu.menu, menu);
return true;
}
正在使用的所有相应的进口。
而且我menu.xml文件如下:
<?xml version="1.0" encoding="utf-8"?>
<menu
xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/backup" android:title="@string/backupLabel"/>
<item android:id="@+id/restore" android:title="@string/restoreLabel"/>
</menu>
的动作条显示,但菜单表现为2.1菜单 - 从没有可用溢出菜单按钮激活只。在ICS仿真器上也是如此 - 我必须使用菜单按钮来激活菜单。
如果我添加android:showAsAction =“ifRoom”,那么这些项显示为操作项 - 但不在溢出中,这是我希望它们始终存在的位置。
这一切都有道理吗?
我错过了什么?
http://stackoverflow.com/questions/9286822/how-to-force-use-of-overflow-menu-on -devices-with-menu-button –
http://stackoverflow.com/questions/8758263/how-to-force-overflow-menu-on-android-actionbar-compat –
保罗是否通过提供的链接修复了您的问题? – Warpzit