Changing actionBar dropdown background color

android, android-actionbar, java, xml

Solution

For example, in you exisiting parent `Style` definition, add just the `android:popupMenuStyle` attribute as shown below:

<style name="Theme.Example" parent="@android:style/Theme.Holo.Light">
    <item name="android:popupMenuStyle">@style/PopupMenu.Example</item>
    .......
    .......
</style>

And override the `android:popupMenuStyle` attribute by defining your style:

<style name="PopupMenu.Example" parent="@android:style/Widget.Holo.Light.ListPopupWindow">
    <item name="android:popupBackground">@drawable/menu_dropdown_panel_example</item>
</style>

The `@drawable/menu_dropdown_panel_example` is this:

You can either choose to use an image similar to the one above, or use an `Color` resource.

And this is for the default ActionBar. Not the `ActionBarSherlock`. ;-)

`ActionBar` styles can be easily created using this cool website: http://jgilfelt.github.com/android-actionbarstylegenerator/. I usually experiment a little here before deciding on the style. Plus, it lets you download the styles and all necessary resources. Just plug them in your app and you are good to go. :-)

UPDATED: I think I caused some confusion which has resulted in the loss of the shadow on your app's drop-down. You may have replaced all the `<items>` in your `Style` that I listed in the original suggestion. The edit should fix that.

UPDATE 2:

Use these image resources instead of the `@android:color/white` value you are currently using. These are in the order of XHDPI, HDPI and MDPI. Save them and use them in the Style definition.

Problem

How do i change the color of the background where it says "add contact" and "about". Now its kind of grayish, but i want it to be white! This is a actionBar with dropdown, not a spinner. And im not using that actionbarsherlock thing.

Original source