how to change option menu background color
There problem with the material theme
<style name="Theme.MyApplication" parent="Theme.AppCompat.DayNight.DarkActionBar">
<item name="android:itemBackground">@color/bluish_green</item>
</style>
<style name="ThemeOverlay.MyTheme" parent="Theme.MyApplication">
<!-- To change the popup menu and app text color -->
<item name="android:textColor">@color/white</item>
<!-- To change the background of options menu-->
<item name="android:itemBackground">@color/black</item>
<item name="android:popupBackground">@color/black</item>
<item name="android:drawablePadding">0dp</item>
<item name="android:dividerHeight">1dp</item>
</style>
How to change the background color of Action Bar's Option Menu in Android 4.2?
There is an easy way to change the colors in Actionbar
Use ActionBar Generator and copy paste all file in your res
folder and change your theme in Android.manifest file.
Toolbar options menu background color
To change the toolbar options menu color, add this to your toolbar element
app:popupTheme="@style/MyDarkToolbarStyle"
Then in your styles.xml
define the popup menu style
<style name="MyDarkToolbarStyle" parent="ThemeOverlay.AppCompat.Light">
<item name="android:colorBackground">@color/mtrl_white_100</item>
<item name="android:textColor">@color/mtrl_light_blue_900</item>
</style>
Note that you need to use colorBackground
not background
. The latter would be applied to everything (the menu itself and each menu item), the former applies only to the popup menu.
Is there a way to change the background of an option menu in tkinter?
Okay everyone I found out how to do it by printing the option menu's config and looking through all the parameters. Turns out I had to add this:
<widget ref>.config(bg = "gray", highlightthickness = 0)
Theming Android's Options Menu
<item name="popupMenuBackground">?themeColorPrimary</item>
As simple as it is!
If you like to use a style, use:
<item name="popupMenuStyle">@style/MyActionBar</item>
instead of:
<item name="android:popupMenuStyle">@style/MyActionBar</item>
Related Topics
Error Androidmanifest.Xml Doesn't Exist or Has Incorrect Root Tag
Android Studio - Xml Editor Autocomplete Not Working With Support Libraries
Photo Rotated from Camera (Samsung Device)
Android: Keep Service Running When App Is Killed
How to Execute Code When Application Is Closing
Install Apps Silently, With Granted Install_Packages Permission
How to Delete or Remove Cardview from Recyclerview - Android Studio
How to Validate Password Field in Android
Reload Recyclerview from Within the Adapter of the Recycler View
How to Check If the Current Activity Has a Dialog in Front
Waiting Till the Async Task Finish Its Work
How to Set Android_Ndk_Home So That Android Studio Does Not Ask for Ndk Location
Get City Name and Postal Code from Google Place API on Android
How to Verify Purchase for Android App in Server Side (Google Play in App Billing V3)
How to Set Align (Right or Left) of Text in Textview, Programmatically
How to Painlessly Change My App Title Text Color
How to Implement Referral Program in Mobile Apps for Both Android and Iphone