forcewill
forcewill

Reputation: 1647

Android menu item not showing drawable

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

Upvotes: 0

Views: 5264

Answers (2)

Jitesh Dalsaniya
Jitesh Dalsaniya

Reputation: 1917

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.

Upvotes: 3

Szymon
Szymon

Reputation: 43023

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

Upvotes: 1

Related Questions