I use RelativeLayouts extensively in my app and thought I knew how to specify them, but this has me at a loss. I am basically positioning 4 TextViews in two rows of two each consisting of a label and text that will be supplied. It should look something like:
Born: 23 Aug 1810 Mason Co., Kentucky
Died: 15 Jul 1865 Cincinnati, Hamilton Co., Ohio
This is the relevant portion of the layout:
<TextView android:id="@+id/birth_lbl"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/given_layout"
android:layout_alignLeft="@+id/given_layout"
android:layout_marginTop="6dip"
style="@style/label"
android:text="@string/born"
/>
<TextView android:id="@+id/birth"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@+id/birth_lbl"
android:layout_alignBaseline="@+id/birth_lbl"
android:layout_marginLeft="10dip"
android:layout_marginRight="6dip"
style="@style/main_text"
android:text="dd Mmm yy"
/>
<TextView android:id="@+id/death_lbl"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/birth"
android:layout_alignLeft="@+id/birth_lbl"
android:layout_marginTop="4dip"
style="@style/label"
android:text="@string/died"
/>
<TextView android:id="@+id/death"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@+id/death_lbl"
android:layout_alignLeft="@+id/birth"
android:layout_alignBaseline="@+id/death_lbl"
android:layout_marginRight="6dip"
style="@style/main_text"
android:text="dd Mmm yy"
/>
For some reason, this displays the death line views ABOVE the birth line views! If I change the spec of the death_lbl view to instead be 'layout_below="@+id/birth_lbl"', the lines are positioned correctly! However, it is possible for the "birth" view to wrap to multiple lines, so I really need to position the 2nd line below "birth", not "birth_lbl".
Anyone know the reason for this behavior? It occurs both in the Graphical Layout editor in Eclipse and at runtime on my tablet running Android 4.0.