新建个selectortext_color.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="#ff7318" android:state_checked="true"/>
<!-- 选中时效果 -->
<item android:color="#7f7f7f" android:state_checked="false"/>
<!-- 未选中时效果 -->
</selector>
style
<style name="qy_bottom_home_style" parent="@android:style/Widget.CompoundButton.RadioButton">
<item name="android:button">@drawable/qy_bottom_home_bg</item>
<item name="android:textColor">@drawable/text_color</item>
</style> <RadioButton
android:id="@+id/rb_qy_bottom_home"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/qy_bottom_home_style"
android:layout_weight="1"
android:background="@android:color/transparent"
android:button="@null"
android:drawableTop="@drawable/qy_bottom_home_bg"
android:gravity="center"
android:text="@string/qy_bottom_home"
android:textSize="12.0sp" />
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="#ff7318" android:state_checked="true"/>
<!-- 选中时效果 -->
<item android:color="#7f7f7f" android:state_checked="false"/>
<!-- 未选中时效果 -->
</selector>
style
<style name="qy_bottom_home_style" parent="@android:style/Widget.CompoundButton.RadioButton">
<item name="android:button">@drawable/qy_bottom_home_bg</item>
<item name="android:textColor">@drawable/text_color</item>
</style> <RadioButton
android:id="@+id/rb_qy_bottom_home"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/qy_bottom_home_style"
android:layout_weight="1"
android:background="@android:color/transparent"
android:button="@null"
android:drawableTop="@drawable/qy_bottom_home_bg"
android:gravity="center"
android:text="@string/qy_bottom_home"
android:textSize="12.0sp" />
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="#ff7318" android:state_checked="true"/>
<!-- 选中时效果 -->
<item android:color="#7f7f7f" android:state_checked="false"/>
<!-- 未选中时效果 -->
</selector>
style
<style name="qy_bottom_home_style" parent="@android:style/Widget.CompoundButton.RadioButton">
<item name="android:button">@drawable/qy_bottom_home_bg</item>
<item name="android:textColor">@drawable/text_color</item>
</style> <RadioButton
android:id="@+id/rb_qy_bottom_home"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/qy_bottom_home_style"
android:layout_weight="1"
android:background="@android:color/transparent"
android:button="@null"
android:drawableTop="@drawable/qy_bottom_home_bg"
android:gravity="center"
android:text="@string/qy_bottom_home"
android:textSize="12.0sp" />
刚刚测试了一下,不行啊 大神,实现不了
我刚刚RadioButton默认的textColor去掉,又运行了一下 确实没有问题。 谢谢你拉!结贴!