CheckBox自定义
<CheckBox
android:id="@+id/account_checkBox_agree"
android:layout_width="140dip"
android:layout_height="wrap_content"
android:button="@drawable/checkbox"
android:text="已阅读并同意"
android:textColor="#024089"
android:textSize="15sp"
android:checked="true"
android:singleLine="true"
android:layout_toLeftOf="@id/account_agreement_link"
android:layout_alignBottom="@id/account_agreement_link"
android:layout_centerVertical="true"
></CheckBox>
checkbox.xml 在drawable目录下
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="true" android:state_focused="true"
android:drawable="@drawable/checkbox_on_background_focus_yellow" />
<item android:state_checked="false" android:state_focused="true"
android:drawable="@drawable/checkbox_off_background_focus_yellow" />
<item android:state_checked="false" android:state_focused="false"
android:drawable="@drawable/checkbox_off_background" />
<item android:state_checked="true" android:state_focused="false"
android:drawable="@drawable/checkbox_on_background" />
</selector>
之后再添加需要的效果图片即可
更多相关文章
- android
- android给view比如layout等添加阴影效果
- Android(安卓)studio 签名 报错:Could not download groovy-all.j
- 关于Android(安卓)如何配置测试类
- imageView动画效果
- Android(安卓)Button 上添加图片
- RecylcerView中的子view matchParent属性失效的问题
- GridLayout 使用总结
- android中实现指针滑动的动态效果