How to show icons in ActionBar overflow menu?

Alexey Zakharov picture Alexey Zakharov · Aug 16, 2012 · Viewed 30.6k times · Source

I want to display icon in addition to menu item title in overflow dropdown menu.

Is is possible?

Answer

androido picture androido · Apr 16, 2013

put your menu with property android:showAsAction="always" and in xml file of menu add sub menus under that your menu like this

<item
        android:id="@+id/mainMenu"
        android:icon="@drawable/launcher"
        android:showAsAction="always">
        <menu>

            <item
                android:id="@+id/menu_logout"
                android:icon="@drawable/log_out"
                android:title="logout"/>
        </menu>
    </item>

this will show the icons in menus