user3314121
user3314121

Reputation: 13

android overflow menu item is unable to display both icon and title

I am trying to set image in overflow menu items like as in flipkart.But I am unable to set image.Can anybody provide me code snippet for doing this

Upvotes: 0

Views: 1041

Answers (3)

Dinesh Babu
Dinesh Babu

Reputation: 144

It is not possible to add icons in overflow menu item as per googles new change, If u still want, try this. for device with overflow hardware button: override hardware button click and show a transparent fragment with list view as like over flow menu in samsung devices(S3, s4) with icon.

for devices without hardware button: use sub menu to look as menu. google still supports icon in sub menu.

Upvotes: 0

Mark Buikema
Mark Buikema

Reputation: 2540

That's how it's supposed to work.

If the icon shows in the action bar, it will only show the icon (with an optional title by using android:showAsAction="always|withText" or android:showAsAction="ifRoom|withText").

If the icon does not show in the action bar, it will only show in the overflow menu as text. Note that there is no "withIcon" enum value for the android:showAsAction attribute.

Upvotes: 0

Shobhit Puri
Shobhit Puri

Reputation: 26007

If you are trying on Android 3.0+, it won't show icons in the menu items. Google has removed them in order to make the menu look similar on different apps. See icon in menu not showing in android and on Android Developers blog.

Upvotes: 1

Related Questions