Hyeyeon blog

[Android] CheckBox, RadioButton에 Custom Image 적용 본문

개발/Android

[Android] CheckBox, RadioButton에 Custom Image 적용

Hyeyeon.P 2020. 10. 14. 15:26
반응형

1. selector.xml 생성

<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:drawable="@drawable/checked" android:state_checked="true" />
    <item android:drawable="@drawable/unchecked" android:state_checked="false" />
    <item android:drawable="@drawable/unchecked" />   <!-- 아무 상태도 지정하지 않으면 기본 값 --> 
</selector>

 

2. CheckBox 혹은 RadioButton의 button에 적용

<CheckBox
    android:button="@drawable/selector"
    .. /> 
<RadioButton
    android:button="@drawable/selector"
    .. /> 

 

728x90
Comments