在我的android活动中,我通过使用此主题删除了操作栏
<style name="Theme.NoTitle" parent="@android:style/Theme.NoTitleBar"></style>
但我的问题是“ onCreateOptionsMenu”没有显示,我尝试使用此方法创建
那请看
private void getOverflowMenu()
{
try
{
ViewConfiguration config = ViewConfiguration.get(Home.this);
Field menuKeyField = ViewConfiguration.class.getDeclaredField("sHasPermanentMenuKey");
if (menuKeyField != null)
{
menuKeyField.setAccessible(true);
menuKeyField.setBoolean(config , false);
}
} catch (Exception e)
{
e.printStackTrace();
}
}
在此“ onCreateOptionsMenu”中不显示。请帮我
但它显示在三星
因为:在三星手机中有自己的硬件菜单按钮,但是在Nexus等中没有
请看图片
最佳答案
终于我得到了答案
在我的AndroidManifest.xml中,我刚刚删除了这一行
android:targetSdkVersion="18"