안드로이드 기본 체크박스 아닌 원하는 체크박스 모양으로 커스텀하는 방법
res/drawable 폴더에 새로운 xml파일을 생성한다.
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!-- 체크박스 해제 상태 -->
<item android:state_checked="false"
android:drawable="@drawable/unchecked"/>
<!-- 체크박스 선택 상태 -->
<item android:state_checked="true"
android:drawable="@drawable/checked"/>
</selector>
위와 같은 코드 작성.
체크박스 선택 여부에 따라 이미지 설정함.
android:background="@drawable/custom_checkbox"
android:button="@null"
CheckBox를 커스텀할 때
android_button="@null" or android:button="@android:color/transparent" 를 작성하여 기존 체크박스를 투명색으로 지정해야 커스텀된 체크박스가 크기에 맞게 들어감.
reference
https://salix97.tistory.com/227
https://dev-minsuuuus.tistory.com/30