Share the post "How To Set Android ActionBar AppCompat PopupMenu Selected Item Background After Long Click"
So you created an overflow menu that contains another sub-menu in Android’s ActionBar. Everything works well after you styled the background color of Widget.AppCompat.PopupMenu.
Once you tried a long click on the overflow MenuItem and proceed to selected a sub MenuItem, you notice the selected background color of the item is not transparent.
The cause for this is because you used android:background. The correct attribute to use is android:colorBackground.
That should fix it.
See sample XML code:
|
1 2 3 4 |
<style name="PopupTheme" parent="Widget.AppCompat.PopupMenu"> <item name="android:colorBackground">@color/black</item> <item name="android:textColor">@color/white</item> </style> |
And in your theme style, add this:
|
1 |
<item name="actionBarPopupTheme">@style/PopupTheme</item> |