Android options menu icon won’t display

I’m following a book on Android Development to get myself started writing my first real app. I got up to the point where I’m making an options menu for one of my activities. The menu shows up, but the corresponding icon of the menu item refuses to display. Here is the code for the menu:

ReminderListActivity

@Override
    public boolean onCreateOptionsMenu(Menu menu) {
        super.onCreateOptionsMenu(menu);
        MenuInflater mi = getMenuInflater();
        mi.inflate(R.menu.list_menu, menu);
        return true;
    }

res/menu/list_menu.xml

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
    <item android:id="@+id/menu_insert"
        android:icon="@drawable/menu_add"
        android:title="@string/menu_insert" />

</menu>

I have copied the ic_menu_add.png icon (32x32px) from one of my Android SDK subfolders to my res/drawable-mdpi folder and renamed the file to menu_add.png. I refreshed the folder within eclipse so the icon shows up, and as you can see I set it as the icon for the menu item in my layout file. I tried running my project in the emulator a few times, but the icon never shows up. For the record, I am using Android 4.0.3..

Any ideas?

Android – Options Menu wont work

I am trying to create an Options menu in an Activity that gets started from a Service and then changes its UI based on messages from the Service passed via a Handler. I set up the Options menu as foll

Cannot Display Icon In The Options Menu

Hello guys I am really frustrated this is what I want to get but I what ever I do I cannot get my icon bonded to my Options Menu. I have tried @Override public boolean onCreateOptionsMenu(Menu menu)

No icon showing in Android Options menu item

I have created an options menu with an icon I made myself (24px x 24px) but it is not showing. The code in my xml (located in res/menu) is the following: <?xml version=1.0 encoding=utf-8?> &

Android Menu Icon with Title : Title doesn’t display

Here is my XML <?xml version=1.0 encoding=UTF-8?> <menu xmlns:android=http://schemas.android.com/apk/res/android> <item android:[email protected]+id/refresh android:title=Home android:icon

Android Menu custom Icon

How can I add a custom icon to my android menu the code below is what I currently have in my xml file. <item android:[email protected]+id/item1 android:[email protected]:drawable/ic_menu_add android:title=Blo

Android: how to show icon in ActionBar but not in the Options Menu?

How can I show an icon in an ActionBar but not in the Options Menu at the same time? Is it possible via XML only?

android menu icon size

I need to set the menu icon programmatically (Not through a layout file), and also I need to load the icon file from file:///android_asset/ (Not load as a compiled Drawable). I found the size of the d

Android Menu options in layout does not show icon

I just added a Menu to my activity. Additionally I want to set some icons to each menu item. Therefore I tried both these methods but I do not see these icons on the device. What am I doing wrong ? I

Display options menu using onClickListener

I was just wondering whether it is possible to display my options menu to be displayed when I click on a image. Now I have displayed my options menu when the menu button is clicked. But I would like t

Changing options menu icon in actionbar depending on an open Fragment

I have this item in my options menu: <item android:[email protected]+id/opt_mnu_action android:[email protected]:drawable/ic_dialog_info android:orderInCategory=1 android:showAsAction=ifRoom android:title=

Answers

On Android 3.0+, the preferred approach for the options menu (a spillover menu in the action bar) will not show icons. If you have android:targetSdkVersion=”11″ or higher, icons will never show up in menus on Android 3.0+. The icons will show up if you promote an options menu item to be a toolbar button, and the icons will show up on Android 1.x/2.x devices.

A good idea is that you created a layout with RelativeLayout and when user selected your menu, your layout is displayed.

This is perfectly working for me in API 23

<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:context=".MainActivity">
<item
    android:icon="@drawable/ic_menu"
    android:orderInCategory="100"
    android:title="Option Menu"
    app:showAsAction="always">
    <menu>
        <item
            android:id="@+id/action_myorder"
            android:icon="@drawable/ic_order"
            android:title="My Order" />
        <item
            android:id="@+id/action_myaccount"
            android:icon="@drawable/ic_account"
            android:title="My Account" />
        <item
            android:id="@+id/action_share"
            android:icon="@drawable/ic_share"
            android:title="Share" />
        <item
            android:id="@+id/action_term_condition"
            android:icon="@drawable/ic_terms"
            android:title="Term and Conditions" />
        <item
            android:id="@+id/action_logout"
            android:icon="@drawable/ic_logout"
            android:title="Logout" />
    </menu>
</item>