RelativeLayout 知识点

1.RelativeLayout层叠

a.布局文件如下
   <RelativeLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignBottom="@+id/vp_content"
            android:layout_alignParentRight="true" >

<!-- 这里放了一个LinearLayout 和一个ImageView,他的先后顺序,决定了层次的上下,若是这样布局,则LinearLayout在上层。 -->
            <LinearLayout
                android:id="@+id/ll_point_list"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="horizontal" >
            </LinearLayout>

            <ImageView
                android:id="@+id/red_point"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:src="@drawable/small_point_red" />
        </RelativeLayout>
b.结论
所以在RelativeLayout布局中加控件时要考虑先后顺序,放在前面的在下层。

摘:http://www.th7.cn/Program/Android/201404/188860.shtml

1.RelativeLayout布局中的元素如果要实现元素叠加必须设置RelativeLayout.ALIGN_PARENT_TOP 和 RelativeLayout.ALIGN_PARENT_LEFT 这样元素才会进行叠加,否则元素就会按照加入的顺序无叠加放置。

2.RelativeLayout布局中的叠加元素的次序只决定于声明的先后(无论是使用xml布局文件还是使用纯代码布局),也就是说一旦开始决定了他们的叠放次序,就无法更改了,即使删除之后再次进行添加也不行。

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值