我在一个应用程序上工作了很长时间,到目前为止我使用的是顶部带有操作栏的主题。
现在在操作栏中我有 3 点符号(使用 galaxy nexus)。
我决定不再需要操作栏了,当我通过 Manifest 将其取下时,我没有像我应该的那样把它放在下面。
有什么想法吗?
谢谢。
这是 Activity 的代码:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//initialize
this.spMain = getSharedPreferences("main", 0);
this.numofcourses = this.spMain.getInt("numofcources", 0);
this.tvTotalAvarge = (TextView)findViewById(R.id.totalAvarage);
this.mainLayout = (LinearLayout)findViewById(R.id.mainlayout);
if(this.numofcourses ==0) {
Intent intent = new Intent(this,Newuser.class);
startActivity(intent);
finish();
}
else this.loadCourses();
}
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.activity_main, menu);
return true;
}
public boolean onOptionsItemSelected(MenuItem item) {
Intent intent =new Intent(this, Newuser.class);
startActivity(intent);
finish();
return true;
}
最佳答案
查看文章 Say Goodbye to the Menu Button
如果您的应用在没有专用菜单按钮的设备上运行,系统会根据您在 list 元素中声明支持的 API 级别来决定是否将操作溢出添加到导航栏。逻辑归结为:
如果您将 minSdkVersion 或 targetSdkVersion 设置为 11 或更高,系统将不会添加旧版溢出按钮。
否则,系统将在 Android 3.0 或更高版本上运行时添加遗留溢出按钮。
唯一的异常(exception)是,如果您将 minSdkVersion 设置为 10 或更低,将 targetSdkVersion 设置为 11、12 或 13,并且您不使用 ActionBar,系统将在运行您的应用程序时添加遗留溢出按钮Android 4.0 或更高版本的手机。
关于java - 无法使首选项 3 点菜单可见,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13483813/