Changing the background Color of the Popup-/Overflow-Menu on Android?

RustamGalljamovRustamGalljamov USMember ✭✭
edited January 2016 in Xamarin.Forms

Hey together, has anyone already changed the Background Color of the Android PopupMenu in a Xamarin.Forms app?

The following code in the Styles.xml should but has not worked for me:

<style name="AppTheme" parent="android:Theme.Material.Light"> <item name="android:popupMenuStyle">\@style/PopupMenu</item> </style> <style name="PopupMenu" parent="@android:style/Widget.Material.Light.ListPopupWindow"> <item name="android:popupBackground">@android:color/popup_background_color</item> </style>

Also the following approaches weren't successful so far:

  • PopupMenu instead of ListPopupWindow as the style's parent
  • android:style instead of _@android:style/

Do you have any ideas? Thanks in advance!

Answers

  • JacobPoulsen_JacobPoulsen_ DKMember ✭✭✭

    Hey @RustamGalljamov

    Did you ever find a solution to this issue? :-)

  • RustamGalljamovRustamGalljamov USMember ✭✭

    Hey @JacobPoulsen_,
    yes and I hope it will work for you too:
    The key was to define the actionBarPopupTheme in your main App Theme:
    <style name="Theme.YourAppsName" parent="android:Theme.Material. <item name="android:actionBarPopupTheme">@style/Theme.YourAppsName.ActionBarPopupTheme</item> </style> ... which extends the ThemeOverlay.Material.Light:
    <style name="Theme.YourAppsName.ActionBarPopupTheme" parent="android:ThemeOverlay.Material.Light"> <item name="android:colorBackground">@color/actionbar_popupmenu_background_color</item> <item name="android:textColor">@color/actionbar_popupmenu_text_color</item> </style>
    Good Luck!

  • rio_riyario_riya INMember ✭✭

    not working !

Sign In or Register to comment.