How to change the background color of the options menu?

feragusper picture feragusper · May 31, 2010 · Viewed 157.2k times · Source

I'm trying to change the default color for the options menu which is white: I want a black background for every item on the options menu.

I've tried some shoots like android:itemBackground="#000000" on the item element within the menu element but it didn't work.

How can I accomplish this?

Answer

TheIT picture TheIT · Mar 11, 2015

After spending a considerable amount of time trying all the options, the only way I was able to get an app using AppCompat v7 to change the overflow menu background was using the itemBackground attribute:

<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    ...
    <item name="android:itemBackground">@color/overflow_background</item>
    ...
</style>

Tested from API 4.2 to 5.0.