ANDROID相对布局说明

   在相对布局中,一般用到的控件属性解释如下:

         在相对布局中有如下属性,解释如下:

         android:layout_above  为将该控件的底部放在指定id控件的上方

         android:layout_below   同理类似,将该控件的顶部放在指定id控件的下方

         android:layout_toLeftOf  将该控件的右端紧挨着放在指定id控件的左端。

         android:layout_toRightOf  将该控件的左端紧挨着放在指定id控件的右端

         android:layout_alignParentRight  为true时将该控件右端与父控件右端对齐

         android:layout_alignParentLeft       为true时将该控件左端与父控件左端对齐

         android:layout_alignParentTop       为true时将该控件顶端与父控件顶端对齐

         android:layout_alignParentBottom  为true时将该控件底端与父控件底端对齐

         android:layout_alignBottom            将该控件底部与指定id控件底部控件对齐

         android:layout_alignLeft                   将该控件左边与指定id控件左边对齐

         android:layout_alignRight                 将该控件右边与指定id控件右边对齐

         android:layout_alignTop                    将该控件顶端与指定id控件顶端对齐


<RelativeLayout
        android:id="@+id/relativeLayout0"
        android:layout_width="match_parent" android:layout_height="wrap_content"

        <ImageView
            android:layout_width="35dip"
            android:layout_height="35dip"
            android:src="@drawable/ic_truck_type_1_yes"
            android:id="@+id/icon_orderId"
            android:layout_marginTop="5dp"
            android:layout_marginLeft="10dp"
            android:gravity="center_vertical|center_horizontal"/>
        <TextView
            android:layout_width="40dip"
            android:layout_height="wrap_content"
            android:id="@+id/txtId"
            android:layout_toRightOf="@id/icon_orderId"
            android:layout_alignTop="@id/icon_orderId"
            android:layout_marginTop="12dp"
            android:layout_marginLeft="5dp"
            android:singleLine="true"
            style="@style/normalText"/>

        <ImageView
            android:layout_width="35dip"
            android:layout_height="35dip"
            android:id="@+id/icon_time"
            android:src="@drawable/ic_time"
            android:layout_toRightOf="@id/txtId"
            android:layout_alignTop="@id/icon_orderId"
            android:layout_marginLeft="15dp"/>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/txtCreatedDate"
            android:layout_toRightOf="@id/icon_time"
            android:layout_alignTop="@id/icon_time"
            android:layout_marginTop="12dp"
            android:layout_marginLeft="5dp"
            android:singleLine="false"
            style="@style/normalText"/>

        <ImageView
            android:layout_width="35dip"
            android:layout_height="35dip"
            android:src="@drawable/icon_name"
            android:id="@+id/icon_name"
            android:layout_alignLeft="@id/icon_orderId"
            android:layout_below="@id/icon_orderId"
            android:layout_marginTop="10dp"/>
        <TextView
            android:id="@+id/txtClientName"
            android:layout_width="40dip"
            android:layout_height="wrap_content"
            android:layout_toRightOf="@id/icon_name"
            android:layout_alignTop="@id/icon_name"
            android:layout_marginLeft="5dp"
            android:layout_marginTop="10dp"
            android:text="hello"
            style="@style/normalText"
            android:textAppearance="?android:attr/textAppearanceMedium" />

        <ImageView
            android:layout_width="35dip"
            android:layout_height="35dip"
            android:src="@drawable/icon_mobile"
            android:id="@+id/icon_contact"
            android:layout_toRightOf="@id/txtClientName"
            android:layout_alignTop="@id/icon_name"
            android:layout_marginLeft="15dp"/>

        <TextView
            android:id="@+id/txtPhone"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_toRightOf="@id/icon_contact"
            android:layout_alignTop="@id/txtClientName"
            android:layout_marginLeft="5dp"
            style="@style/normalText"
            android:text="1389765"/>


    </RelativeLayout>


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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值