无法在Android上更改单选按钮颜色 [英] Can't change Radio Button color on Android
问题描述
我使用Android Studio。我需要更改单选按钮的颜色,更改后的按钮色调颜色值到我需要它的工作原理预览,但每当我在设备上启动应用程序的按钮是标准的绿色/蓝色的颜色。
I'm using Android Studio. I need to change the color of the Radio Button, after changing the Button Tint Color value to the one I need it works on the preview, but whenever I launch the app on a device the button is the standard green/blue-ish color.
这是某种类型的设备API级别问题吗?
Is this some kind of device API level issue? If so, is it possible to change the color for older devices?
推荐答案
阅读@ Ranjith的回答后,我做了一些挖掘和这似乎工作。
After reading @Ranjith's answer i did a little digging and this seemed to work. Just add it to your AppTheme.
//red is the color of the pressed state and activated state
<item name="colorControlActivated">@android:color/holo_red_light</item>
//black is the color of the normal state
<item name="colorControlNormal">@android:color/black</item>
我的问题是如何做这个程序,因为我有动态单选按钮
My question is how do you do this programatically as I have dynamic radio buttons??
这篇关于无法在Android上更改单选按钮颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!