原生的控件在点击的时候会在前面的图形中出现一圈涟漓效果;
如果需要去掉则设置:
<RadioButton
android:layout_marginTop="19.5dp"
android:id="@+id/love_style_single"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/MyCheckBox_Love"
android:background="@drawable/radiotbtn_ripplecolor"
android:text=" 我是单身狗"/>
通过background设定一个透明的颜色效果:
radiotbtn_ripplecolor.xml :
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:color="#00000000"
tools:targetApi="lollipop">
</ripple>
style是设置自定义图片的替换:
MyCheckBox_Love.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="MyCheckBox_Love" parent="@android:style/Widget.CompoundButton.RadioButton">
<item name="android:button">@drawable/checkbox_love</item>
</style>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="true" android:drawable="@mipmap/xuanzhong_love" />
<!-- <item android:state_selected="true" android:drawable="@mipmap/xuanzhong"></item>
<item android:state_pressed="true" android:drawable="@mipmap/xuanzhong"></item>-->
<item android:state_checked="false" android:drawable="@mipmap/weixuan" />
</selector>