0

Im using the ActionBarActivity on my activity and inflating the following menu

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

<item android:id="@+id/menu_refresh"
    android:icon="@drawable/ic_action_refresh"
    android:title="@string/description_refresh"
    android:orderInCategory="1"
    microecs:showAsAction="ifRoom" />


<!--TODO: get a good logout icon-->
<item
    android:id="@+id/menu_logoff"
    android:icon="@drawable/ic_action_logout"
    android:title="@string/description_logoff"
    android:orderInCategory="2"

    microecs:showAsAction="never" />
</menu>

The second menu item drawable that i want to appear as a menu and not in the action bar doesn't not appear in my S4 (running 4.3) and also on lower devices running 2.3.7

Harish Godara
  • 2,388
  • 1
  • 14
  • 28
forcewill
  • 1,637
  • 2
  • 16
  • 31

2 Answers2

3

Just update your code with following code.

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

<item android:id="@+id/menu_refresh"
    android:icon="@drawable/ic_action_refresh"
    android:title="@string/description_refresh"
    android:orderInCategory="1"
    microecs:showAsAction="ifRoom" />


<!--TODO: get a good logout icon-->
<item
    android:id="@+id/menu_logoff"
    android:icon="@drawable/ic_action_logout"
    android:title="@string/description_logoff"
    android:orderInCategory="2"

    microecs:showAsAction="ifRoom" />
</menu>

Whenever you are using never then it dont place that item in the Action Bar.

For about menu refer this link.

Jitesh Dalsaniya
  • 1,917
  • 3
  • 20
  • 36
1

This is not possible by design. Overflow menus from the action bar don't show icons - that's just a design decision Google made.

You can check more, e.g. here: Displaying icon for menu items of Action Bar in Honeycomb android 3.0

Community
  • 1
  • 1
Szymon
  • 42,577
  • 16
  • 96
  • 114