2

I'm trying to change the color of PopMenu that is displayed by a onlongclick method. I used the following style but had no effect, are there any suggestions on how I can change the style of PopMenu? The style was declared in AndroidManifest.xml

<style name="NewStyle" parent="android:Theme.NoTitleBar.Fullscreen">
    <item name="android:popupMenuStyle">@style/PoppupMenu</item>
</style>

<style name="PoppupMenu" parent="android:Widget.PopupMenu">
    <item name="android:popupBackground">@drawable/corazul</item>
</style>
Marcus Martins
  • 424
  • 6
  • 19

1 Answers1

17

I solved the problem using this code:

Context wrapper = new ContextThemeWrapper(getContext(), R.style.PopupMenu);
PopupMenu popupMenu = new PopupMenu(wrapper, v);

reference: blog.stylingandroid.com

shem
  • 4,686
  • 2
  • 32
  • 43
Marcus Martins
  • 424
  • 6
  • 19
  • 4
    This solved my problem, but I used the "android:itemBackground" attribute instead of "android:popupBackground" in my style definition – AtlasRider Oct 13 '16 at 22:59