Android menu background black with Theme.AppCompat? Android menu background black with Theme.AppCompat? xml xml

Android menu background black with Theme.AppCompat?


You can change the background color of the popup menu as below.

  1. Create a style in your styles.xml

    <style name="PopupMenuStyle" parent="Theme.AppCompat.Light">     <item name="android:background">@android:color/white</item></style>
  2. Set this theme as your toolbar popup theme in your toolbar.xml

     <android.support.v7.widget.Toolbar         xmlns:app="http://schemas.android.com/apk/res-auto"        xmlns:android="http://schemas.android.com/apk/res/android"        // Your code here       app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"       app:popupTheme="@style/PopupMenuStyle" />

Hope this helps.


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.


You can just use appNS to define the popupTheme as shown below.

app:popupTheme="@style/ThemeOverlay.AppCompat.Light"