to change the color of switch you can use two images
- green - when switch is ON
- red - when switch is OFF
now put this file in drawable folder
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/blue_checked" android:state_checked="true"/>
<item android:drawable="@drawable/blue_unchecked" android:state_checked="false"/>
</selector>
and in the layout XML file use it as below
<CheckBox
android:id="@+id/user_checkbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:button="@drawable/notif_checkbox_selector"
/>