xml - Android Layout Text at Left and Image at Right -


i trying to make list image stay on right of layout time. @ same time if there no image subject text fill whole layout.

this hope achieve
when image hide
enter image description here
with image
enter image description here

current output:
image @ front on text.
enter image description here

<?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="@drawable/icon" /> </relativelayout> 

try this...cheers :)

<relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:padding="6dip" android:layout_height="?android:attr/listpreferreditemheight">  <imageview     android:id="@+id/icon"     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:layout_alignparentright="true"     android:layout_alignparenttop="true"      android:src="@drawable/icon" />  <textview     android:id="@+id/subject"             android:layout_width="wrap_content"     android:layout_height="wrap_content"         android:text="apple orange apple orange apple orange apple orange apple orange apple orange"     android:layout_toleftof="@id/icon"/> <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" /> 


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -