ActionBarSherlock, ActionBar And Native Menu, How To Proceed?
Solution 1:
Check out the Menu Resource in the Android API Documentation and especially:
android:showAsAction=["ifRoom" | "never" | "withText" | "always" | "collapseActionView"]
The example XML from the documentation is a good resource also for exactally how to lay it out:
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/item1"
android:title="@string/item1"
android:icon="@drawable/group_item1_icon"
android:showAsAction="ifRoom|withText"/>
<group android:id="@+id/group">
<item android:id="@+id/group_item1"
android:onClick="onGroupItemClick"
android:title="@string/group_item1"
android:icon="@drawable/group_item1_icon" />
<item android:id="@+id/group_item2"
android:onClick="onGroupItemClick"
android:title="@string/group_item2"
android:icon="@drawable/group_item2_icon" />
</group>
<item android:id="@+id/submenu"
android:title="@string/submenu_title"
android:showAsAction="ifRoom|withText" >
<menu>
<item android:id="@+id/submenu_item1"
android:title="@string/submenu_item1" />
</menu>
</item> </menu>
You then need to add to your Manifest:
android:uiOptions="splitActionBarWhenNarrow"
That will move your buttons down to the bottom, leave the title in the actionbar and if you have more than what can fit in the screen you get the little three dot | on the right of the lower actionbar. This only really works in Portrait mode though, unless you have quite a few menu items... or longer text strings (I think...)
Solution 2:
ActionBarSherlock puts your menu stuff in the ActionBar across all supported platform versions. Add it as library project and make sure that you import the Sherlock Menu and extend SherlockActivity.
Post a Comment for "ActionBarSherlock, ActionBar And Native Menu, How To Proceed?"