[Android] Displaying an image in a TextView


Writing time : 2013-07-22 20:38:37

Displaying an image in a TextView

Android Developer Document


http://developer.android.comhttps://developer.android.com/reference/android/widget/TextView.html

Reference content


It is an excerpt from the above URL, and you can see how to set it with xml and how to set it with method.

Attribute Name Related Method Description
android:drawableBottom setCompoundDrawablesWithIntrinsicBounds(int,int,int,int) The drawable to be drawn below the text.
android:drawableEnd setCompoundDrawablesRelativeWithIntrinsicBounds(int,int,int,int) The drawable to be drawn to the end of the text.
android:drawableLeft setCompoundDrawablesWithIntrinsicBounds(int,int,int,int) The drawable to be drawn to the left of the text.
android:drawablePadding setCompoundDrawablePadding(int) The padding between the drawables and the text.
android:drawableRight setCompoundDrawablesWithIntrinsicBounds(int,int,int,int) The drawable to be drawn to the right of the text.
android:drawableStart setCompoundDrawablesRelativeWithIntrinsicBounds(int,int,int,int) The drawable to be drawn to the start of the text.
android:drawableTop setCompoundDrawablesWithIntrinsicBounds(int,int,int,int) The drawable to be drawn above the text.
Previous post