0

I have the following code to generate a Menu Item:

<menu xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:id="@+id/menu1"
          android:icon="@drawable/ic_action1"
          android:title="@string/foo" />
</menu>

I see the Item in the menu, but I can not see the icon. Whats wrong? I dont want to use it as the following:

android:showAsAction="ifRoom|withText"

then I see the icon, but I dont want it to be in the Action Bar

gurehbgui
  • 14,236
  • 32
  • 106
  • 178

2 Answers2

1

When you are using the ActionBar / Holo theme, you won't see any menu item icons in the overflow menus, sorry. I think you will get the old menu back when you apply a pre-Holo theme to your activity!

Goddchen
  • 4,459
  • 4
  • 33
  • 54
0

try something like this

    onCreateOptionsMenu(Menu menu){
       MenuInflater inflater = getMenuInflater();
        inflater.inflate(R.menu.your_menu, menu);

       menu.getItem(R.id.your_item_id).setIcon(R.drawable.your_drawable_id);
    }
Opiatefuchs
  • 9,800
  • 2
  • 36
  • 49