How to change the color of a CheckBox?

Piyush picture Piyush · May 2, 2011 · Viewed 260.6k times · Source

How do I change the default CheckBox color in Android?
By default the CheckBox color is green, and I want to change this color.
If it is not possible please tell me how to make a custom CheckBox?

Answer

afathman picture afathman · Nov 20, 2015

You can change the color directly in XML. Use buttonTint for the box: (as of API level 23)

<CheckBox
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:buttonTint="@color/CHECK_COLOR" />

You can also do this using appCompatCheckbox v7 for older API levels:

<android.support.v7.widget.AppCompatCheckBox 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    app:buttonTint="@color/COLOR_HERE" />