switch_thumb.xml
http://schemas.android.com/apk/res/android">
android:left="1dp"
android:right="1dp"
android:top="1dp"
android:bottom="1dp">
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
android:width="19dp"
android:height="19dp" />
android:color="#FFFFFF" />
android:width="1dp"
android:color="#FFFFFF" />
switch_track_on.xml
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
android:radius="15dp" />
android:width="45dp"
android:height="21dp" />
android:color="#7F8FFF" />
android:width="2dp"
android:color="#7F8FFF" />
switch_track_off.xml
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
android:radius="15dp" />
android:width="45dp"
android:height="21dp" />
android:color="#999999" />
android:width="2dp"
android:color="#999999" />
corners : 스위치 배경의 라운드 효과.
solid : 스위치 배경의 가운데 부분 색.
stroke : 스위치 배경의 바깥 부분 색 // width만큼 테두리가 생김.
switch_track_selector.xml
http://schemas.android.com/apk/res/android">
android:drawable="@drawable/switch_track_off"
android:state_checked="false"/>
android:drawable="@drawable/switch_track_on"
android:state_checked="true"/>
실 액티비티에 사용 시
android:id="@android:id/checkbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@null"
android:clickable="false"
android:focusable="false"
android:track="@drawable/switch_track_selector"
android:thumb="@drawable/switch_thumb"
/>