I have a ListView with items consisting of RelativeLayouts. This is the corresponding XML from the list items:
<?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/xx" android:gravity="center_vertical" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:layout_centerInParent="true" android:layout_alignParentLeft="true"/> <TextView android:id="@+id/title" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_toRightOf="@id/xx" /> <TextView android:id="@+id/tag" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_toRightOf="@id/xx" android:layout_below="@id/title" /> <TextView android:id="@+id/subtitle" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_toRightOf="@id/tag" android:layout_below="@id/title" /> </RelativeLayout>
In Android 2.1 (tested on Nexus One) this shows the desired behavior: Android 1.5 http://img42.imageshack.us/img42/7668/85324076.png
However, on Android 1.5 (tested on HTC Hero) it looks like this: Android 1.5 http://img257.imageshack.us/img257/2849/72229324.png
[edit] In 1.6 (emulator), it works just as expected.
The little gray line in the upper left corner is what appears in the first image as “xx”, so it should be vertically centered. As far as I can see, XML dictates this, but for some reason 1.5 ignores it.
Why is this? I cannot find anything about this difference, and I was rude, forcing any combination of layout_center, center, alignParent *, but to no avail ...
Can anyone shed some light on this? Thanks!
benvd source share