I’m trying to position two TextView’s to the right of an image view (note this is not in a list). I followed this example which works but problems occur when I start to increase the text size and background of the TextView. Here the top text view seems to expand despite setting the height to wrap_content.
Looking at the example I don’t really understand
android:layout_height=”?android:attr/listPreferredItemHeight”
and why the layout height is set to 26dip
android:layout_height=”26dip”
Here is my xml with the minor changes to layout_height which I thought would work
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:padding="6dip">
<ImageView android:id="@+id/icon" android:layout_width="wrap_content"
android:layout_height="fill_parent" android:layout_alignParentTop="true"
android:layout_alignParentBottom="true" android:layout_marginRight="6dip"
android:src="@drawable/icon" />
<TextView android:id="@+id/secondLine" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_toRightOf="@id/icon"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true" android:background="@layout/rounded"
android:textSize="20sp" android:singleLine="true" android:textColor="#FFFFFF"
android:textStyle="bold" android:ellipsize="marquee" android:padding="10dip"
android:layout_margin="5dip"
android:text="Simple application that shows how to use RelativeLayout" />
<TextView android:layout_width="fill_parent"
android:layout_height="wrap_content" android:background="@layout/rounded"
android:layout_toRightOf="@id/icon" android:textSize="20sp"
android:singleLine="true" android:textColor="#FFFFFF"
android:textStyle="bold" android:layout_alignParentRight="true"
android:layout_alignParentTop="true" android:layout_above="@id/secondLine"
android:padding="10dip" android:layout_margin="5dip" android:gravity="center_vertical"
android:text="My Application" />
</RelativeLayout>
And this is the resulting image???

Any help would be appreciated.
I just stumbled on this post which seems to work
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/RelativeLayout" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:padding="6dip">
<ImageView android:id="@+id/Icon" android:layout_margin="5dip"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_centerVertical="true" android:src="@drawable/addphoto" />
<TextView android:id="@+id/topLine" android:layout_height="wrap_content"
android:layout_width="fill_parent" android:layout_margin="4dip"
android:layout_toRightOf="@+id/Icon" android:background="@layout/rounded"
android:padding="10dip" android:textSize="20sp" android:singleLine="true"
android:textColor="#FFFFFF" android:textStyle="bold" android:text="Name" />
<TextView android:id="@+id/bottomLine" android:layout_height="wrap_content"
android:layout_width="fill_parent" android:layout_margin="4dip"
android:layout_toRightOf="@+id/Icon" android:layout_below="@+id/topLine"
android:padding="10dip" android:background="@layout/rounded"
android:textSize="20sp" android:singleLine="true" android:textColor="#FFFFFF"
android:textStyle="bold" android:text="Address" />
</RelativeLayout>
You see that result because you have the following attributes on the textview:
android:layout_alignParentTop="true"andandroid:layout_above="@id/secondLine".The above attributes specify that the top must be aligned with the parent and the bottom must be just above the ‘secondline’ component.
I removed the above two attributes and did a few more changes to your layout to get to what I believe you want. See the layout below. I hope this layout achieves what you wish to obtain.