0
我正在用模擬器測試我的應用程序,我的3點按鈕顯示完美。3點按鈕出現在仿真器中,但不在devie中
當我使用我的真實設備(Samsung Galaxy S3)進行測試時,那些3點按鈕從未出現過,我不知道爲什麼。相反,我得到的所有3個按鍵,而我只想要1個+ 3個按鈕...
這裏是我的菜單
這裏的OnCreate中和的SelectedItem方法
@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_affichage_notes,menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId())
{
case R.id.action_logout:
//création d'un Intent
Intent intent = new Intent(AffichageNotes.this, PageAccueil.class);
//ajout de fonctionnalités qui vont être transférés
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK |
Intent.FLAG_ACTIVITY_NO_ANIMATION | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
//transfert aussi de la valeur EXIT qui est true
intent.putExtra("EXIT", true);
startActivity(intent);
return true;
case R.id.action_setting:
Intent a = new Intent(AffichageNotes.this,Reglages.class);
startActivity(a);
return true;
case R.id.action_add:
Intent i = new Intent(AffichageNotes.this,AjoutTexte.class);
Bundle args = new Bundle();
int id = getIntent().getIntExtra("id",0);
i.putExtra("id",id);
startActivity(i);
return true;
}
return super.onOptionsItemSelected(item);
}
錯誤來自哪裏?感謝你們 !
哦,是的,是的,我板缺並沒有注意到它抱歉.. – David
@大衛,你能看到動作欄?也許你因爲你的主題看不到,你可以發佈你的style.xml文件嗎? –
找到解決方案! '嘗試ViewConfiguration config = ViewConfiguration.get(this); Field menuKeyField = ViewConfiguration.class.getDeclaredField(「sHasPermanentMenuKey」); (menuKeyField!= null){ menuKeyField.setAccessible(true); menuKeyField.setBoolean(config,false); (例外){ //忽略 } – David