Add this to your toolbar item.
app:popupTheme="@style/ThemeOverlay.YourPopup"
Then in styles.xml specify popup menu style
<style name="ThemeOverlay.YourPopup" parent="ThemeOverlay.AppCompat.Light"> <item name="android:colorBackground">@color/mtrl_white_100</item> <item name="android:textColor">@color/mtrl_light_blue_900</item> </style>
<style name="ThemeOverlay.YourPopup" parent="ThemeOverlay.AppCompat.Light"> <item name="android:colorBackground">@color/mtrl_white_100</item> <item name="android:textColorPrimary">@color/mtrl_light_blue_900</item> </style>
Note that you need to use android:colorBackground and never android:background . The latter will be applied to everything that has no background (here the menu itself and each menu item), the first applies only to the pop-up menu.
Update: The same applies to textColorPrimary and textColor .
- The popup menu item defines
android:textColor="?android:textColorPrimary" . android:textColorPrimary is a theme attribute defined for themes.android:textColor is a style attribute defined in widgets.- If we defined
android:textColor in the theme, this applies to every widget that does not define its own android:textColor .
source share