0

In one of my Android projects, I am creating a context menu from a menu folder inside res. It is as below.

<menu xmlns:android="http://schemas.android.com/apk/res/android">
  <item android:id="@+id/help"
    android:title="Help" />
  <item android:id="@+id/keyboard"
    android:title="Keyboard" />
  <item android:id="@+id/exit"
    android:title="Exit" />
</menu>

But I want an image to the background of every item. How can I do this?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Android Killer
  • 18,174
  • 13
  • 67
  • 90
  • It is a repeat question, and you can find it here: [enter link description here][1] [1]: http://stackoverflow.com/questions/4604562/override-context-menu-colors-in-android – Hai Bo Wang Feb 20 '12 at 08:19

2 Answers2

1

Try this:

<menu xmlns:android="http://schemas.android.com/apk/res/android">
  <item android:id="@+id/help"
    android:title="Help" 
    android:icon="@drawable/ic_1/>
  <item android:id="@+id/keyboard"
    android:title="Keyboard"
    android:icon="@drawable/ic_2" />
  <item android:id="@+id/exit"
    android:title="Exit" 
    android:icon="@drawable/ic_3/>
</menu>
Roman Black
  • 3,501
  • 1
  • 22
  • 31
-1

Use styles in your app. Then you can change a default style of Widget.ListView. Note this also changed a style of dialogs with ListView. More details see in this answer.

Community
  • 1
  • 1
Oleksii Masnyi
  • 2,922
  • 2
  • 22
  • 27