Ich habe ein Problem mit einer RelativeLayout
enthält zwei TextView
s und eine ImageView
, die ich für die Anzeige von Elementen in einem ListView
verwenden. Die Elemente werden auf Android 1.6 korrekt angezeigt, aber auf Android 2.2 überlappen sich die TextView
s. HierÜberlappende TextView-Elemente in RelativeLayout in 2.2; Kein Problem in 1.6
ist ein Bild, das die richtige und falsche Verhalten Seite an Seite zeigt:
Und hier ist der Quellcode meiner RelativeLayout:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="?android:attr/listPreferredItemHeight"
android:padding="6dip">
<ImageView
android:id="@+id/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentBottom="true"
android:layout_marginRight="6dip"
/>
<TextView
android:id="@+id/secondLine"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:singleLine="true"
android:layout_below="@+id/firstLine"
android:layout_toRightOf="@id/icon"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
/>
<TextView
android:id="@+id/firstLine"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textStyle="bold"
android:ellipsize="marquee"
android:singleLine="true"
android:layout_toRightOf="@id/icon"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
/>
</RelativeLayout>
Jede Idee, was Ich mache falsch?
Vielen Dank,
Philipp
Ich konnte es mit Octavians Antwort lösen. Vielen Dank für Ihre ausführliche Erklärung! – Philipp
Es wird das Problem nicht lösen, da es einfach nicht so funktioniert. 'layout_below' wird ignoriert, wenn Sie Ihre Ansichten wie oben definieren. –