android radioButton 选中后改变字体颜色样式

来源:互联网 发布:健康风险评估软件 编辑:程序博客网 时间:2024/05/01 09:37

radioButton用radioGroup包起来

如下为样式:

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">


   
    <item android:state_checked="true" android:color="@color/red"></item>
    <item android:color="@color/black"></item>


</selector>

选中为红色,未选中默认为黑色


如下红色部分为调用样式

 <RadioButton
                android:id="@+id/inrbtnout"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/intypeout"
                android:textColor="@drawable/checkrbtn"
                android:button = "@drawable/checkimg"
                android:textSize="30dp" />

0 0
原创粉丝点击