I'm trying to restyle my app to an ICS look and feel with ABS. Getting the ActionBar itself was nice and straightforward, however adding menu items has not been.
My code looks like:
@Override
public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);
MenuInflater inflater = getSupportMenuInflater();
inflater.inflate(R.menu.menu, menu);
return true;
}
All the appropriate imports are being used.
And my menu.xml is as follows:
<?xml version="1.0" encoding="utf-8"?>
<menu
xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/backup" android:title="@string/backupLabel"/>
<item android:id="@+id/restore" android:title="@string/restoreLabel"/>
</menu>
The ActionBar shows, but the menu behaves as a 2.1 menu - only activating from the menu button with no overflow available. This is also true on an ICS emulator - where I have to use the menu button to activate the menu.
If I add android:showAsAction="ifRoom" then the items appear as action items - but not in the overflow, which is where I would like them to always be.
Does that all make sense?
What am I missing?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…