user2586307
user2586307

Reputation:

android - set image in background of part of a text in text view

I want to implement a book in android with some option. one of these is to set a picture in background of part of text . how can I do this??

thanks

Upvotes: 0

Views: 415

Answers (3)

Ketan Ahir
Ketan Ahir

Reputation: 6738

try this and fix heght of imageview ase per you requirement

 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <ImageView
        android:id="@+id/image"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

    <TextView
        android:id="@+id/text"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

</RelativeLayout>

Upvotes: 0

InnocentKiller
InnocentKiller

Reputation: 5234

Use below code in your XML file.

<TextView
    android:id="@+id/textView1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:background="@drawable/yourImageName"
    />

Upvotes: 2

Karthick pop
Karthick pop

Reputation: 616

Set textview background

android:background="@drawable/imgsrc"

Upvotes: 0

Related Questions