0
我是一名Android初學者,與ActionBar
合作項目,但我被卡住了。菜單不是ActionBar
。卡在操作欄android
activity_main_actions.xml
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<!-- Search/will display always -->
<item android:id="@+id/action_search"
android:icon="@drawable/ic_action_search"
android:title="@string/action_search"
android:showAsAction="ifRoom"/>
<!-- Location Found -->
<item android:id="@+id/action_location_found"
android:icon="@drawable/ic_action_location_found"
android:title="@string/action_location_found"
android:showAsAction="ifRoom" />
<!-- Refresh -->
<item android:id="@+id/action_refresh"
android:icon="@drawable/ic_action_refresh"
android:title="@string/action_refresh"
android:showAsAction="ifRoom" />
<!-- Help -->
<item android:id="@+id/action_help"
android:icon="@drawable/ic_action_help"
android:title="@string/action_help"
android:showAsAction="never"/>
<!-- Check updates -->
<item android:id="@+id/action_check_updates"
android:icon="@drawable/ic_action_refresh"
android:title="@string/action_check_updates"
android:showAsAction="never" />
</menu>'
</resources>'
MainActivity.class
public class MainActivity extends ActionBarActivity {
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.activity_main_actions, menu);
return super.onCreateOptionsMenu(menu);
}
}
但是,只有搜索和位置圖標來了其餘三件物品不會來。 –
改變總是或ifRoom在「yourapp:showAsAction =」從不「 –