Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set the background of Android PopupMenu to White [duplicate]

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.

like image 490
joe7wu Avatar asked Jun 02 '13 00:06

joe7wu


1 Answers

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.

like image 72
daniel_c05 Avatar answered Sep 23 '22 14:09

daniel_c05