Mohammed Elsabry
Mohammed Elsabry

Reputation: 23

Android : How to make TextView with compound bitmap

i want to create a TextView with compound Bitmap, i know android support creating TextView with compound drawables but i want to compound Bitmap as i downloaded images online

note : i don't want to make LinearLayout holds imageview and textview

Upvotes: 2

Views: 2075

Answers (1)

Michell Bak
Michell Bak

Reputation: 13242

Here's how to do it in XML code. This adds a Drawable at the top. You can change it to left, right or bottom:

<TextView
android:id="@+id/id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableTop="@drawable/yourdrawable"
/>

Edit

Sorry, totally misread your question. You can do this in code by creating a BitmapDrawable and then using that as a compound Drawable. More info here: http://developer.android.com/reference/android/graphics/drawable/BitmapDrawable.html

Upvotes: 2

Related Questions