android:layout_below,Android layout_below not working

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:

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"

/>

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"

/>

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"

/>

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.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值