How to change the background color of Action Bar's Option Menu in Android 4.2?

后端 未结 17 1275
别那么骄傲
别那么骄傲 2020-11-22 16:00

I\'d like to change the background color of the option (overflow) menu in Android 4.2. I have tried all the methods but it is still showing the default color set by the them

17条回答
  •  萌比男神i
    2020-11-22 17:06

    In case you are working in the latest toolbar in android studio then here is the smallest solution 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

    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.

提交回复
热议问题