6

I'm struggling with setting the background of PopupMenu. After googling it for a while, I found it should goes to the app theme. To be more specific, this should be defined in the style.xml.

<style name="AppTheme" parent="AppBaseTheme">
    <item name="android:popupMenuStyle">MY_STYLE</item>
</style>

However, I didn't really figure out which style exactly I should use, as I assume there's a built-in one. I tried with @android:style/Widget.Holo.PopupMenu and @android:style/Widget.Holo.Light.PopupMenu, but with no luck.

chollida
  • 7,834
  • 11
  • 55
  • 85
joe7wu
  • 73
  • 1
  • 1
  • 4
  • See answer on this [qustion](http://stackoverflow.com/questions/12636101/how-to-style-popupmenu) – Bishan Jun 02 '13 at 00:45
  • I've seen it actually; I tried with setting `popupMenuStyle` to `Widget.Holo.Light.PopupMenu` as well as `popupBackground` to `@android:color/background_light`, but it still does not work. – joe7wu Jun 02 '13 at 00:50

1 Answers1

6

For instance, try something like this:

<style name="Theme.MyAppTheme" parent="@style/Theme.Holo.Light">
    <item name="popupMenuStyle">@style/PopupMenu.MyAppTheme</item>
</style>

And then on the style itself:

<style name="PopupMenu.MyAppTheme" parent="@style/Widget.Holo.Light.ListPopupWindow">
    <item name="android:popupBackground">@drawable/popup_menu_bg_color</item>
</style>

That is the way it's done via ActionBarStyleGenerator and some old references here on the Developer Site.

daniel_c05
  • 11,438
  • 17
  • 60
  • 78
  • Thank you for the reply. But where is the @drawable/pop_menu_bg_color? I didn't find it in the res generated by ActionBarStyleGenerator. – joe7wu Jun 02 '13 at 16:57
  • It should rather be: parent="@android:style/Widget.Holo.Light.ListPopupWindow" – Suhayl SH Nov 24 '16 at 06:37