How do I get an imageview reference in a composite drawing in android?… here is a solution to the problem.
How do I get an imageview reference in a composite drawing in android?
If you have such a TextView + image:
<TextView
android:id="@+id/textView4"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:drawableRight="@drawable/calendar" />
How do I get an ImageView reference from a textview reference in java code?
I want to set up click events for images, not TextView.
Does anyone know?
Thank you.
Solution
textView.getCompoundDrawables()
will get drawableLeft, drawableRight
, drawableTop, and drawableBottom
items
. and
setCompoundDrawables() to set
them.