2015-10-16 16 views
-4

我用這個變革的菜單:如何讓沒有菜單的應用程序? Android的

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; 
} 

但是......

如果我想,我的活動有沒有菜單,怎麼做呢?

我想讓菜單沒有菜單,因爲我沒有在這個場景中導航。如何做到這一點?

+1

剛剛從你的代碼中刪除的片段,延伸活動到活動(android.app.activity)。 –

+1

Thx。修復了這個問題。 –

回答

-1

在活動中刪除這兩個方法:

@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); 
} 
+0

如果您確定答案,那麼您可以投票。 –

相關問題