Instead of using a single output, you should write a selector:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:drawable="@drawable/drawable_checked"
android:state_checked="true" />
<item
android:drawable="@drawable/drawable_unchecked"
android:state_checked="false" />
</selector>
And then set it to an attribute android:checkMark.
source
share