Search code examples
androidandroid-menu

Android drop down menu item is not showing icon along with the text


Here is my menu item.

    <item
    android:id="@+id/stores"
    android:orderInCategory="100"
    android:icon="@drawable/stores"
    android:showAsAction="never"
    android:title="@string/favoritestores"/>

It shows the text alone and not the icon in the drop down. I have the drawable in the path correctly. I am using this in API level 14+ . What might be the issue in this?

I have tried to set icon through code. But still I am not able to see icons

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.home, menu);
    MenuItem menuItem = menu.findItem(R.id.menu_settings);
            menuItem.setIcon(R.drawable.action_search);
    return true;
}

Solution

  • Icons are not shown since Android 3.0 Honeycomb (API level 11+). If you run it on some older Android, you should see them...

    If you wanted to show those icons however, you would have to use them in ActionBar