Custom Checkbox in android

by Monday, December 30, 2013 0 comments
checkbox.xml
   


checkbox.java
 import android.content.Context;  
 import android.graphics.Color;  
 import android.util.AttributeSet;  
 import android.widget.CheckBox;  
 public class checkbox extends CheckBox {  
      public checkbox(Context context, AttributeSet attrs) {  
           super(context, attrs);  
           // setButtonDrawable(new StateListDrawable());  
      }  
      @Override  
      public void setChecked(boolean t) {  
           if (t) {  
                this.setBackgroundResource(R.drawable.chk_blue_bg);  
                this.setTextColor(Color.WHITE);  
           } else {  
                this.setBackgroundResource(R.drawable.chk_white_bg);  
                this.setTextColor(Color.BLACK);  
           }  
           super.setChecked(t);  
      }  
 }  

karthik nagarajan

Androider

Welcome to Android-Action Blog. I’m a normal guy, who is passionate about Mobile Coding. Here I am writing about Android. Happy learning

0 comments:

Post a Comment