В Kotlin:
1) Набор drawable
:
val drawable = ContextCompat.getDrawable(context!!,R.drawable.ic_image)?.apply {
setBounds(0, 0, intrinsicWidth, intrinsicHeight)
}
или
val drawable = ResourcesCompat.getDrawable(resources, R.drawable.ic_image, null)?.apply {
setBounds(0, 0, minimumWidth, minimumHeight)
}
2) Набор TextView
:
textView.setCompoundDrawablesWithIntrinsicBounds(drawable, null, null, null)
или
button.setCompoundDrawables(null, drawable, null, null)