Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to change checkbox icon

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 703
    Comment on it

    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)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: