如何更改android中单选按钮的边框颜色?
如何更改android中单选按钮的边框颜色?如何更改android中单选按钮的边框颜色?
我想更改android单选按钮的圆形颜色。
在此先感谢。任何帮助是极大的赞赏。
我必须尝试不同的soluation和关注,如果任何财产是否有其他的是可绘制的图像
最简单的方式来定制(改变颜色)的意见。
转到:http://android-holo-colors.com/
- 选择您想要的单选按钮的颜色
- 下载输出资源(Download.Zip)
- 解压缩zip内容
- 从提取的zip文件复制到您的项目可绘制,样式和值
- 将您的应用主题的父级更改为您下载的主题
- 而且你得到了你想要的东西
没错,这就是你正在寻找的属性:buttonTint,但只适用于API级别21以上
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/radio"
android:checked="true"
android:buttonTint="@color/your_color"/>
在你的价值观
/colors.xml把你的肤色在这种情况下,一个红色之一:
<color name="your_color">#e75748</color>
结果:
据我所知,在API级别这仅适用于21或更高。这意味着它不会对较低版本的Android产生影响。 – March3April4 2015-07-31 09:57:03
你说得对,我忘了告诉,谢谢,我已经更新了这篇文章以包含它 – 2015-08-01 18:46:12
尝试使用AppCompatRadioButton
<android.support.v7.widget.AppCompatRadioButton
android:id="@+id/rb"
app:buttonTint="@color/colorAccent" //This to set your default button color
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
欲了解更多详情检查这个答案:Android: Change the color of RadioButtons and checkboxes programmatically
http://*.com/a/2716089/1838457 – 2013-04-25 11:13:28