개발/개발 자료
(Android) CheckBox 체크이미지 입맛대로 바꿔보자
시원한물냉
2013. 12. 12. 13:09
1. drawable 폴더에 on, off 정의한 xml 파일 생성(selector)
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="true" android:drawable="@drawable/이미지파일 (체크상태)" />
<item android:drawable="@drawable/이미지파일 (비체크상태)" />
</selector>
2. 대상 CheckBox View에 button 속성에 위 selector xml 지정
<CheckBox
android:layout_height="wrap_content"
android:layout_marginTop="20px"
android:layout_width="wrap_content"
android:id="@+id/autologinflag"
android:layout_span="2"
android:textStyle="bold"
android:button="@drawable/check_box"
android:paddingLeft="20px" />