Reputation:
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
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
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