更改"在"交换机的颜色 [英] Change "on" color of a Switch
本文介绍了更改"在"交换机的颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用了一个标准的开关控制在ICS应用程序的holo.light主题。
I'm using a standard Switch control with the holo.light theme in a ICS app.
我想改变高亮或者切换按钮从标准浅蓝绿色状态的颜色。
I want to change the highlighted or on state color of the Toggle Button from the standard light blue to green.
这应该很容易,但我似乎无法找出如何做到这一点。
This should be easy, but I can't seem to work out how to do it.
推荐答案
截至目前,最好是使用SwitchCompat从AppCompat.v7库。然后,您可以用简单的造型来改变你的组件的颜色。
As of now it is better to use SwitchCompat from the AppCompat.v7 library. You can then use simple styling to change the color of your components.
values/themes.xml:
<style name="Theme.MyTheme" parent="Theme.AppCompat.Light">
<!-- colorPrimary is used for the default action bar background -->
<item name="colorPrimary">@color/my_awesome_color</item>
<!-- colorPrimaryDark is used for the status bar -->
<item name="colorPrimaryDark">@color/my_awesome_darker_color</item>
<!-- colorAccent is used as the default value for colorControlActivated,
which is used to tint widgets -->
<item name="colorAccent">@color/accent</item>
<!-- You can also set colorControlNormal, colorControlActivated
colorControlHighlight, and colorSwitchThumbNormal. -->
</style>
REF:<一href="http://android-developers.blogspot.be/2014/10/appcompat-v21-material-design-for-$p$p.html">Android开发者博客
这篇关于更改&QUOT;在&QUOT;交换机的颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文