0
菜單沒有顯示在我的emulator.menu代碼是在home.java類中實現的,充氣器使用菜單但是沒有在模擬器上顯示。菜單inflater沒有在模擬器中顯示
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.home);
}
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater Inflater = getMenuInflater();
Inflater.inflate(R.layout.menu, menu);
return(super.onCreateOptionsMenu(menu));
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == R.id.logout) {
SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0);
SharedPreferences.Editor editor = settings.edit();
editor.remove("logged");
editor.commit();
finish();
}
return super.onOptionsItemSelected(item);
}
}
thnx其工作正常.. :) – shitanshu