从4.2开始,checkbox和右侧文字间距和之前版本有点差别,解决办法:
<CheckBox
android:id="@+id/register_check"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:button="@null"
android:background="@android:color/transparent"
android:drawableLeft="@drawable/checkbox_selector"
android:drawablePadding="5dp"
android:checked="true"
android:text="同意协议"
android:textColor="#669966"
android:textSize="14sp" />
自定义的CheckBox,checkbox_selector.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/checkbox_press" android:state_checked="true"></item>
<item android:drawable="@drawable/checkbox" android:state_checked="false"></item>
<item android:drawable="@drawable/checkbox" ></item>
</selector>