Showing posts with label Custom Checkbox Android. Show all posts
Showing posts with label Custom Checkbox Android. Show all posts

Tuesday, 24 June 2014

[KEY : ANDROID CUSTOM CHECKBOX, CUSTOM CHECKBOX]

Custom Checkbox Android

How to create custom checkbox. Applying stylish checkbox Android

  1. Take two images for both states checked and unchecked. In png format.
  2. Create checkbox in xml.
  3. Create new xml file assign appropriate name like "checkbox_button.xml"

    <?xml version="1.0" encoding="utf-8"?>
    <selector 
    xmlns:android="http://schemas.android.com/apk/res/android">
      <!--checked image-->
        <item android:drawable="@drawable/checkbox_checked" 
        android:state_checked="true"/>
      <!--unchecked image-->
        <item android:drawable="@drawable/checkbox" 
        android:state_checked="false"/>
    
    </selector>

  4. Add button property in check box in xml

    android:button="@drawable/checkbox_button"