0

I am trying to change option menu background , but there is white space top and bottom
my toolbar style

 app:popupTheme="@style/ThemeOverlay.MyTheme"
   <style name="ThemeOverlay.MyTheme" parent="ThemeOverlay.AppCompat.Light">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/colorPrimary</item>

        <!-- 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>
    </style>

Example:

enter image description here

Hakan Dilek
  • 2,178
  • 2
  • 23
  • 35
skypore
  • 23
  • 5
  • Does this answer your question? [How to change the background color of the options menu?](https://stackoverflow.com/questions/2944244/how-to-change-the-background-color-of-the-options-menu) – Hossein Jun 11 '21 at 17:58

2 Answers2

0

Are you searching for this?

Create style for menu in your app style and add that entry in theme of your app don't forgot to add that theme in you menifest's Application tag

android:theme="@style/AppTheme"

0

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>
skypore
  • 23
  • 5