android - RelativeLayout differences between 1.5 and 2.1 -


I have found a ListView with objects made from the relational layout, this is relevant XML from list items:

  & lt ;? Xml version = "1.0" encoding = "UTF-8"? & Gt; & Lt; RelativeLayout xmlns: Android = "http://schemas.android.com/apk/res/android" Android: layout_width = "fill_parent" Android: layout_height = "wrap_content" & gt; & Lt; Android: layout_height = "wrap_content" android: layout_gravity = "center_vertical" android: layout_centerInparent = "true" android: layout_alignParentLeft: Android: layout_height = "wrap_content" android: text = "id =" @ + id / xx "Android: gravity =" center_vertical "Android: layout_width =" wrap_content " = "True" /> & Lt; TextView Android: id = "@ + id / title" android: layout_width = "fill_parent" android: layout_height = "wrap_content" android: layout_toRightOf = "@ id / xx" /> & Lt; Android: layout_height = "wrap_content" android: layout_toRightOf = "@ id / xx" android: layout_below = "@ id / title" /> gt; textView android: id = "@ + id / tag" Android: layout_width = "wrap_content" & Lt; Android: layout_height = "wrap_content" android: layout_toRightOf = "@ id / tag" android: layout_below = "@ id / title" /> gt; textView android: id = "@ + id / subtitle" android: layout_width = "wrap_content" & Lt; / RelativeLayout & gt; On Android 2.1 (tested on the Nexus One), it shows the desired behavior:  

However on Android 1.5 (test on HTC Hero), it shows:

[1.6] (emulator), this works as much as expected.

The small gray lines on the upper left are visible in the first picture "Xx", so that it should be centered vertically, as far as I can see, XML determines it, but for some reason From, 1.5 ignores it.

Why is that so? I am unable to find anything about this difference, and I am compelled any combination of layouts / centers, centers, alignment * to the dead, but to no avail ...

Can anyone put some light on it? Thanks!

layout_gravity is not used for relative layout.

In addition, you are using anti attribtues centerInParent and alignParentLeft .

Use only one of them.

You can use the layout_centerVertical = "true" layout_alignParentLeft = "true"


Comments