Android 如何制作没有菜单的应用程序?安卓

Android 如何制作没有菜单的应用程序?安卓,android,menu,android-actionbar,Android,Menu,Android Actionbar,我使用此选项更改菜单: public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_log_in, menu); return true; } 但是 如果我想让我的活动没有菜单,怎么做 我想制作没有菜单的活动,因为我

我使用此选项更改菜单:

public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.menu_log_in, menu);
    return true;
}
但是

如果我想让我的活动没有菜单,怎么做


我想制作没有菜单的活动,因为我在这个场景中没有导航。如何制作?

在活动中删除以下两种方法:

    @Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.menu_del, menu);
    return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    int id = item.getItemId();

    //noinspection SimplifiableIfStatement
    if (id == R.id.action_settings) {
        return true;
    }

    return super.onOptionsItemSelected(item);
}

只需从代码中删除代码片段,将活动扩展到活动(android.app.activity).Thx。修正了这个问题。如果你对答案满意,那么你可以投票表决。