Change checkMark or size of CheckedTextView
-
17-02-2021 - |
Question
I'm working on an application where I'm using a checkedTextView, it all works great. But I really don't like that layout of the "checkbox" within the checkedTextView, it's simply to big. Is there any way to resize it or change the layout to something custom made?
I've tried the android:checkMark
attribute, but that resulted in it being marked all the time, and thus showing all the time.
Solution
Instead of using a single drawable 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 the android:checkMark
attribute.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow