How to Set a Drawable at the start of Text, in a TextView, in XML
Set a Drawable at start of Text, in a TextView, in XMLandroid:drawableEnd was added in API Level 14
Related Method: setCompoundDrawablesRelativeWithIntrinsicBounds- Add a Drawable to the Start of Text, in a TextView, in Java
The drawable to be drawn to the start of the text.
1. Add a TextView.
2. Add a drawable named myImage.
3. Ensure to change the minSDKVersion to 14, or greater.
<TextView
....
android:drawableStart = "@drawable/myImage"
/>
5. Compile and run!
Related Articles
- setCompoundDrawablesRelativeWithIntrinsicBounds - Add a Drawable to the Start of Text, in a TextView, in Java
- setCompoundDrawablesWithIntrinsicBounds - Add a Drawable Below a TextView
- Set an Image to Background of a TextView, using background
http://developer.android.com/reference/android/widget/TextView.html#attr_android:drawableStart
http://developer.android.com/reference/android/R.attr.html#drawableStart