本文介绍了如何更改溢出菜单项的背景的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试更改溢出菜单中聚焦/按下的菜单项的蓝色背景.

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

我正在谈论这个:

我想我已经覆盖了 Themes.xmlThemeTheme.Holo 的所有可能的属性,并转到了每个样式Styles.xml 但无法更改蓝色背景.

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.

编辑
我发现我应该覆盖的样式是 android:dropDownListViewStyle

但它根本不起作用.但后来我将主题从 Theme.Holo.Light.DarkActionBar 更改为 Theme.Holo.Light ,你猜怎么着?成功了!!

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!!

所以,有人可以对此有所了解吗??如何使用 DarkActionBar 更改主题的颜色??

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

推荐答案

好的,我找到了解决我的问题的方法:链接到 ActionBarSherlock 谷歌群组中的帖子

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

我在 Theme.Holo.Light.DarkActionBar 主题中监督了这个条目:android:actionBarWidgetTheme.

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

现在我所要做的就是定义一个主题,该主题覆盖 Theme.Holo 并带有一种样式:<item name="android:dropDownListViewStyle">@style/myDropDownListView</item> 并指向此主题.

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>

这篇关于如何更改溢出菜单项的背景的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-12 02:45