After I call the setCompoundDrawables
method, the compound Drawable is not shown..
Drawable myDrawable = getResources().getDrawable(R.drawable.btn);
btn.setCompoundDrawables(myDrawable, null, null, null);
Any thoughts?
After I call the setCompoundDrawables
method, the compound Drawable is not shown..
Drawable myDrawable = getResources().getDrawable(R.drawable.btn);
btn.setCompoundDrawables(myDrawable, null, null, null);
Any thoughts?
Example with Kotlin:
Image is blank because it hasn't got specified bounds. You may use
setCompoundDrawables()
but before you should specify image's bounds, usingDrawable.setBounds()
methodA little bit simpler again:
In Kotlin:
1) Set
drawable
:or
2) Set
TextView
:or
I needed to be using
setCompoundDrawablesWithIntrinsicBounds
.Example set to the top:
arguments order: (left, top, right, bottom)