更改动作条下拉背景颜色 [英] Changing actionBar dropdown background color
问题描述
我要如何改变背景它说:添加联系人和左右的颜色。现在,它的那种灰色的,但我希望它是白色的!这是下拉列表中的ActionBar,而不是微调。和IM没有使用actionbarsherlock的事情。
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.
推荐答案
例如,在你已有的父风格
的定义,只添加了安卓:popupMenuStyle
,如下所示的属性:
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>
和覆盖机器人:通过定义自己的风格popupMenuStyle
属性:
<style name="PopupMenu.Example" parent="@android:style/Widget.Holo.Light.ListPopupWindow">
<item name="android:popupBackground">@drawable/menu_dropdown_panel_example</item>
</style>
在 @绘制/ menu_dropdown_panel_example
是这样的:
您可以选择使用一个类似的图像上,或使用颜色
的资源。
You can either choose to use an image similar to the one above, or use an Color
resource.
这是默认的动作条的。不是 ActionBarSherlock
。 ; - )
And this is for the default ActionBar. Not the ActionBarSherlock
. ;-)
动作条
样式可以使用这个很酷的网站上轻松创建:<一href="http://jgilfelt.github.com/android-actionbarstylegenerator/">http://jgilfelt.github.com/android-actionbarstylegenerator/.我通常实验了一下这里决定的样式之前。此外,它可以让你下载的样式和所有必要的资源。只需插入他们在您的应用程序,你是好去。 : - )
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. :-)
更新:我想我造成了一些混乱而造成的阴影,对您的应用程序的下拉损失。你可能已经全部换成了&LT;项目&GT;
在风格
,我在原来的建议中列出。编辑应该解决这个问题。
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.
更新2:
使用这些图像资源,而不是 @android:您目前正在使用的颜色/白
值。这些都是在XHDPI,HDPI和MDPI的顺序。保存和使用它们的样式定义。
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.
这篇关于更改动作条下拉背景颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!