问题描述
我可以更改ATTR的Android的默认颜色(蓝色):activatedBackgroundIndicator
Can I change the default color (blue) of the attr android:activatedBackgroundIndicator?
我开发目标18和minimun 11的应用程序。
I am developing an application for target 18 and for minimun 11.
感谢您
推荐答案
下面是一种方法,您的主题进行更改:
Here is a way to change it on your theme:
更新您的主题,以应用自定义样式上的 activatedBackgroundIndicator
属性(此处父主题是全息光。当然,你可以改变它):
Update your theme to apply your custom style on the activatedBackgroundIndicator
attribute (here the parent theme is Holo Light but you can of course change it):
<style name="AppTheme" parent="@android:style/Theme.Holo.Light">
<item name="android:activatedBackgroundIndicator">@drawable/list_activated_background</item>
</style>
在你的绘制资源文件夹,创建XML文件list_activated_background并定义新的背景指标,例如:
In your "drawable" resource folder, create the XML file list_activated_background and define your new background indicator, for example:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_activated="true" android:drawable="@color/OrangeLight" />
<item android:state_checked="true" android:drawable="@color/OrangeDark" />
<item android:state_pressed="true" android:drawable="@color/OrangeDark" />
<item android:drawable="@android:color/transparent" />
</selector>
然后,只需确保您所呼叫清单文件中自定义主题与机器人:主题=@风格/ AppTheme
在这种情况下,例如:
Then just be sure you are calling your custom theme in the manifest file with android:theme="@style/AppTheme"
in this case for example.
这篇关于机器人的变色:activatedBackgroundIndicator的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!