I have a button and a text-view, text-view has a drawable-left. After click on button the drawable-left should be removed and a plain text should be set to Text-view, but I
How to do this and apply to any of the four drawables with DataBinding
@BindingAdapter(value = [
"leftDrawable",
"topDrawable",
"rightDrawable",
"bottomDrawable"], requireAll = false)
fun setCompoundDrawables(textView: TextView,
@DrawableRes left: Int?,
@DrawableRes top: Int?,
@DrawableRes right: Int?,
@DrawableRes bottom: Int?) {
textView.setCompoundDrawablesWithIntrinsicBounds(
left ?: 0,
top ?: 0,
right ?: 0,
bottom ?: 0
)}