My app's theme is Theme.AppCompat.Light.DarkActionBar
. To change background color of option menu, I inserted this code <item name="android:itemBackground">@color/darkblue</item>
in style.xml. This code worked well, however, some changes that I don't want, were added. Option menu panel's corner turned into be angular from rounded. And ripple effect was gone. How can I change option menu's background color without other changing?
Asked
Active
Viewed 9,155 times
0
-
Here is the possible solution for [How to change the background color of the options menu for MaterialToolbar or Toolbar?](https://stackoverflow.com/a/76234743/14224828) – Rakibul Islam May 12 '23 at 09:56
1 Answers
2
There are some good answers here I tried this and worked
<style name="CustomActionBarTheme"
parent="@android:style/Theme.Holo">
<item name="android:popupMenuStyle">@style/MyPopupMenu</item>
<item name="android:itemTextAppearance">@style/TextAppearance</item>
</style>
<!-- Popup Menu Background Color styles -->
<style name="MyPopupMenu"
parent="@android:style/Widget.Holo.ListPopupWindow">
<item name="android:popupBackground">@color/Your_color_for_background</item>
</style>
<!-- Popup Menu Text Color styles -->
<style name="TextAppearance">
<item name="android:textColor">@color/Your_color_for_text</item>
</style>
i found a better and easier way to do it... just add this to your style and change the color:
<item name="android:itemBackground">#FFFF</item>

Community
- 1
- 1

Saul_programa
- 341
- 1
- 4
- 13