user1684892
user1684892

Reputation: 31

how to set image on text view

I am new to android and in my app I need a text view ,inside that text view I want to display an image at first and text as following to that Image.also I do set background I image for that text.Hope somebody will help.

Upvotes: 0

Views: 1729

Answers (3)

Padma Kumar
Padma Kumar

Reputation: 20031

//you can use drawableLeft, drawableRight, drawableTop, drawableBottom attributes to draw image

<TextView
        android:layout_height="wrap_content"
        android:layout_marginRight="3dp"
        android:paddingRight="10dp"
        android:text="@string/edit" 
        android:background="@drawable/btn_selector"
       android:drawableLeft="@drawable/ic_cab_done_holo_dark"
/>

Ref here:

Upvotes: 2

Ramindu Weeraman
Ramindu Weeraman

Reputation: 354

You can use TextView and Imageview for this.

Upvotes: 0

Ron
Ron

Reputation: 24233

Use android:drawableLeft attribute in your TextView tag in xml.

Upvotes: 0

Related Questions