1

First of all I am not able to find the styling API documentation for check box at Android developer site. I want to make following change to the check box. Currently my checkbox when checked appears like : enter image description here

I want to change color behind the white check mark to other color like :

enter image description here

Is there any styling feature or attribute to achieve this ?

Prashant
  • 4,474
  • 8
  • 34
  • 82

3 Answers3

0
       android:buttonTint="@color/CHECK_COLOR"
       (OR)
       android:button="@drawable/your_check_drawable"
Ramesh sambu
  • 3,577
  • 2
  • 24
  • 39
0

In Material theme it will automatically manage according to primary color of theme. or you can manage according to you with help of custom view.

0

Try like this programmatically

boolean checked =false;

checkbox.setOnClickListener(new OnClickListener() {

@Override
public void onClick(View arg0) {
    if(checked){
        GradientDrawable d=new GradientDrawable();
        d.setColor(Color.BLUE);
        checkbox.setBackgroundDrawable(d);
        }
    else{
        GradientDrawable d=new GradientDrawable();
        d.setColor(Color.RED);
        checkbox.setBackgroundDrawable(d);
    }
    checked = !checked
    }

});

You will have access to many properties of GradientDrawable class to stylize your background. you can see more at Documentation

Shree Krishna
  • 8,474
  • 6
  • 40
  • 68