0
我有一個菜單,但我只能看到顯示在操作欄中的三個菜單項中的兩個。我認爲這是一個空間問題,因爲如果我在xml文件中重新排序項目,我總是會得到前兩個項目。我如何獲得更多的空間來顯示所有三個項目?與菜單項的活動無法顯示兩個以上的菜單按鈕 - holo_light_theme
部分:
....... @Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu items for use in the action bar
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.main_activity_catagory, menu);
return super.onCreateOptionsMenu(menu);
}
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
onBackPressed();
break;
case R.id.action_favorite:
Intent i = new Intent(MapActivity.this, FavouriteListActivity.class);
startActivity(i);
break;
case R.id.action_catagory:
Intent intent = new Intent(MapActivity.this, NearByPlacesActivity.class);
startActivity(intent);
break;
case R.id.action_check:
Intent u = new Intent(MapActivity.this, ChackinListActivity.class);
startActivity(u);
break;
default:
break;
}
return super.onOptionsItemSelected(item);
}
}.........
與菜單項的.xml文件:
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:yourapp="http://schemas.android.com/apk/res-auto" >
<item android:id="@+id/action_check"
android:icon="@drawable/check"
android:title="@string/action_check"
yourapp:showAsAction="ifRoom|withText" />
<item android:id="@+id/action_favorite"
android:icon="@drawable/favourite"
android:title="@string/action_favorite"
yourapp:showAsAction="ifRoom|withText" />
<item
android:id="@+id/action_catagory"
android:icon="@drawable/search"
android:title="@string/action_catagory"
yourapp:showAsAction="ifRoom|withText"/>
</menu>
謝謝!!!像往常一樣愚蠢的錯誤! – ismini09 2014-10-06 07:52:28