I am trying to create a list item that looks like this :-
| date | src | type | value |
| description | .. |
I use the relative layout shown below :-
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true">
</TextView>
<TextView
android:id="@+id/src"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/date"
android:layout_alignParentTop="true">
</TextView>
<TextView
android:id="@+id/type"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/src"
android:layout_alignParentTop="true">
</TextView>
<TextView
android:id="@+id/value"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:gravity="right"
android:layout_toRightOf="@id/type"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:textAppearance="?android:attr/textAppearanceLarge"/>
<TextView
android:id="@+id/description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/date"
android:layout_toLeftOf="@id/value"
android:layout_alignRight="@id/type"
android:layout_alignParentLeft="true"
android:layout_alignParentBottom="true">
</TextView>
</RelativeLayout>
But what I get is more like this :-
| date | src | type |
| description | value |
I can’t get the rightmost cell span two rows. Am I using it the wrong way or there is another right layout type for this.
Thanks
I tried the code you supplied and it works as written. See the image below (I added some color and text so I could actually see it in the GUI layout editor).
However, I think a better implementation that might be more along the lines of what you are looking for would be this:
Which gives you this: