ANDROID相对布局说明

来源:互联网 发布:腾讯云怎么解析cn域名 编辑:程序博客网 时间:2024/05/16 00:42
   在相对布局中,一般用到的控件属性解释如下:

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

         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
原创粉丝点击
热门问题 老师的惩罚 人脸识别 我在镇武司摸鱼那些年 重生之率土为王 我在大康的咸鱼生活 盘龙之生命进化 天生仙种 凡人之先天五行 春回大明朝 姑娘不必设防,我是瞎子 qq群解散了照片怎么办 出租屋没窗户很闷怎么办 二手房交税后房主不卖怎么办 二房东收不到租拖欠房租怎么办 房东不给换门锁怎么办 租房到期房东联系不到租客怎么办 廉租房名下有车怎么办 路边停车收忘记交费怎么办 考编忘记交费了怎么办 深圳公租房入库了接下来怎么办 公租房5年以后怎么办 教务系统密码忘记了怎么办 林科大教务处密码忘记了怎么办 智学号密码忘了怎么办 正方教务管理系统忘记密码怎么办 正方教务系统忘记密码怎么办 教务网密码忘了怎么办 电动车解除限速报警器不响怎么办 公租房住满5年怎么办 广州公租房收入超标怎么办 深圳法院拍卖房子不肯搬走怎么办 上海奉贤公租房的期满怎么办 公租房人口少了怎么办 公租房太远了怎么办 商品房没有门厅业主该怎么办 公帐付款备注错了怎么办 我是农村户口在外省交社保怎么办 北京租房遇到黑中介怎么办 上海租房子不让带孩子怎么办 租的房子没窗户怎么办 北京安河桥安河家园租房被骗怎么办 领完失业金后怎么办 北京公租房太小怎么办 申请公租房太小怎么办 房东电费收贵了怎么办 申请公租房工资超了怎么办 重庆公租房工资超了怎么办 公租房申请父母房子贷款怎么办 公产房父母去世办公证怎么办 动迁过程中承租人去世了怎么办 公租房的房间带阳台怎么办