3

I am having 5 items in the menu, and I only want to show 2 at the time.

<menu xmlns:android="http://schemas.android.com/apk/res/android" >

    <item
        android:id="@+id/menu_start"
        android:icon="@drawable/ic_action_start"
        android:orderInCategory="93"
        android:showAsAction="ifRoom|withText"
        android:title="@string/menu_start"/>
    <item
        android:id="@+id/menu_filter"
        android:icon="@drawable/filter_icon"
        android:orderInCategory="94"
        android:showAsAction="ifRoom|withText"
        android:title="@string/menu_filters"/>
    <item
        android:id="@+id/menu_refresh"
        android:icon="@drawable/ic_menu_refresh"
        android:orderInCategory="95"
        android:showAsAction="never"
        android:title="@string/menu_refresh"/>
    <item
        android:id="@+id/menu_delete_all"
        android:icon="@drawable/ic_menu_delete"
        android:orderInCategory="96"
        android:showAsAction="never"
        android:title="@string/menu_delete_all"/>
    <item
        android:id="@+id/menu_show_hidden"
        android:orderInCategory="97"
        android:showAsAction="never"
        android:icon="@drawable/ic_menu_show_hidden"
        android:title="@string/menu_show_hidden"/>

</menu>

When I test this on Galaxy Nexus, or any device that doesnt have menu button, it creates an overflow menu, however it does not add to be the third one as I would liked, but it removes my second icon and replaces it.

How do I have to setup the actionbar, to have 2 icons on devices without menu button, and 2 + (overflow) on devices that have?

Thanks !

4

0 回答 0