I'm trying to control which action bar items get shown if there is limited space, and have tried the solution in this question and answer: Icons priority on action bar
Everything works fine other than I want to keep the order of the icons in a manner which is different to the priority, whereas the solution above causes the items to be reordered. Is there any way to set a priority for item display, without altering the order that items appear in the actionbar?
I've tried altering the order of the items in the xml, and this has no impact on the order of items as rendered (without the orderInCategory, changing the order in the file does result in a change in the order of items as rendered).
I'm developing against ICS.
menu.xml
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/action_edit"
android:icon="@android:drawable/ic_menu_edit"
android:title="@string/action_edit"
android:showAsAction="ifRoom"
android:orderInCategory="1"
/>
<item
android:id="@+id/action_undo"
android:icon="@android:drawable/ic_menu_revert"
android:title="@string/action_undo"
android:showAsAction="ifRoom"
android:orderInCategory="2"
/>
<item
android:id="@+id/action_delete"
android:icon="@android:drawable/ic_menu_delete"
android:title="@string/action_delete"
android:showAsAction="ifRoom"
android:orderInCategory="3"
/>
<!-- I want this item to be on the right,
but shown in preference to any other items;
setting it's orderInCategory to 0 ensures that it
is shown in preference to other items,
but always places it on the left -->
<item
android:id="@+id/action_addnew"
android:icon="@android:drawable/ic_menu_add"
android:title="@string/action_addnew"
android:showAsAction="ifRoom"
android:orderInCategory="0"
/>
</menu>
Thanks.