Android Layout Text at Left and Image at Right

jobblytalor

New Member
I am trying to to make a list where image stay on the right of the layout all the time. At the same time if there is no image I will like the subject text to fill the whole layout.This is what I hope to achieve
When Image is Hide
xGEgS.png

With Image
2KhJ0.png
Current output:
The image at the front on the text.
iA6jT.png
\[code\]<?xml version="1.0" encoding="UTF-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:padding="6dip" android:layout_height="?android:attr/listPreferredItemHeight"> <TextView android:id="@+id/subject" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_alignParentBottom="true" android:text="Apple Orange Apple Orange Apple Orange Apple Orange Apple Orange Apple Orange"/> <TextView android:id="@+id/cdate" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentBottom="true" android:textColor="#8000FF" android:text="Date" /> <ImageView android:id="@+id/icon" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_alignRight="@id/subject" android:src="http://stackoverflow.com/questions/15824588/@drawable/icon" /></RelativeLayout>\[/code\]
 
Back
Top