Den
Den

Reputation: 1352

Android - How to create CheckBox drawable?

When using CheckBox, some Drawable for this "check" icon is created - AnimatedStateListDrawable. Is there any way to create this drawable programmatically without CheckBox? The only thing I've found inside CompoundButton class is this resource - com.android.internal.R.styleable.CompoundButton_button.

Upvotes: 2

Views: 141

Answers (1)

Den
Den

Reputation: 1352

Found the solution:

val attrs = intArrayOf(android.R.attr.listChoiceIndicatorMultiple)
val ta = getContext().theme.obtainStyledAttributes(attrs)
ta.getDrawable(0)

For RadioButton it's android.R.attr.listChoiceIndicatorSingle.

Upvotes: 3

Related Questions