In certain cases, according to the application we need to change the mark or the drawable of the checkbox.
Step 1:- Create selector in the drawable, say checkbox_selector.xml :-
<?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/checkbox_selected" />
<item
android:state_checked="false"
android:drawable="@drawable/checkbox" />
</selector>
Step 2:- include above created drawable in the intended checkbox as below:-
<CheckBox
android:id="@+id/ch_tns"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:button="@drawable/checkbox_selector"/>
0 Comment(s)