how to change background of overflow menuitem

2019-03-30 15:45发布

I am trying to change the blue background of a focussed/pressed menuitem in the overflow menu.

I'm talking about this:

image http://oi48.tinypic.com/2j104l0.jpg

I think I've overwritten every possible attribute from the Themeand Theme.Holo in Themes.xml and went to each style in Styles.xml but couldn't change the blue background.

EDIT
i figured out that the style i should override is android:dropDownListViewStyle

but it didn't work at all. but then i changed the theme from Theme.Holo.Light.DarkActionBar to Theme.Holo.Light and guess what? it worked!!

so, can anyone shed some light on this?? how can i change the color on a theme with DarkActionBar??

2条回答
We Are One
2楼-- · 2019-03-30 16:24

ok, i found a solution for my problem: link to a post in the ActionBarSherlock google group

i've overseen this entry: android:actionBarWidgetTheme in the Theme.Holo.Light.DarkActionBar theme.

now all i had to do is define a theme that overrides Theme.Holo with one style in it: <item name="android:dropDownListViewStyle">@style/myDropDownListView</item> and point to this theme instead.

<!-- theme referenced by actionBarWidgetTehme style -->
<style name="Theme.DropDown.Dark" parent="android:style/Theme.Holo">
    <item name="android:dropDownListViewStyle">@style/myDropDownListView</item>
</style>

<!-- my main theme -->
<style name="DarkActionBarRedActionMode" parent="android:style/Theme.Holo.Light.DarkActionBar">
    <item name="android:actionBarWidgetTheme">@style/Theme.DropDown.Dark</item>
</style>
查看更多
老娘就宠你
3楼-- · 2019-03-30 16:32

declare a selector drawable, and put it as background of listview item.

refer to drawable resource

查看更多
登录 后发表回答