RadioGroup选择改变背景和字体颜色

首先在darwable里写xml

背景颜色的改变:

xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="true" android:drawable="@color/colorPrimary">item>
selector>
字体颜色的改变:

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/colorAccent" />
<item android:state_checked="false" android:color="@color/hei">item>
selector>

你可能感兴趣的:(RadioGroup选择改变背景和字体颜色)