You tried to create a selector and assign this selector to your CheckBox as follows:
//drawable file called cb_selector <?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/checked" /> <item android:state_checked="false" android:drawable="@drawable/unchecked" /> </selector>
In your layout file apply this file to checkbox
<CheckBox android:id="@+id/myCheckBox" android:text="My CheckBox" android:button="@drawable/cb_selector" android:layout_width="wrap_content" android:layout_height="wrap_content"/>
@drawable/checked and @drawable/unchecked are two images of your checkbox, so you can add the color you want there
OR without changing the layout of the buttons by adding this attribute to your checkbox
android:buttonTint="@color/YOUR_CHECKMARK_COLOR_HERE"
source share