关于Android 相对布局中的属性 的介绍和运用
来源:互联网 发布:程序员在重庆好发展吗 编辑:程序博客网 时间:2024/05/12 12:37
相对布局中的属性的运用
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity" > <!-- RelativeLayout:相对布局;子控件相对父容器;子控件相对兄弟控件 --> <!-- 相对属性不设置控件默认位置在父容器左上角 --> <!-- 子控件相对父容器属性: --> <!-- layout_alignParentRight:相对于父容器右侧 --> <!-- layout_alignParentBottom:相对于父容器底部 --> <!-- layout_alignParentLeft:相对于父容器左侧 --> <!-- layout_alignParentTop:相对于父容器顶部 --> <!-- layout_centerInParent:垂直水平居中 --> <!-- layout_centerVertical:垂直居中 --> <!-- layout_centerHorizontal:水平居中 --> <TextView android:layout_width="50dp" android:layout_height="50dp" android:layout_alignParentRight="true" android:background="#000fff" android:text="right|top" /> <TextView android:layout_width="50dp" android:layout_height="50dp" android:layout_alignParentBottom="true" android:background="#fff000" android:text="left|bottem" /> <TextView android:layout_width="50dp" android:layout_height="50dp" android:layout_alignParentLeft="true" android:background="#000fff" android:text="Left|Top" /> <TextView android:layout_width="50dp" android:layout_height="50dp" android:layout_alignParentBottom="true" android:layout_alignParentRight="true" android:background="#fff000" android:text="right|bottem" /> <TextView android:layout_width="50dp" android:layout_height="50dp" android:layout_centerInParent="true" android:background="#f0f0f0" android:text="center" /> <TextView android:layout_width="50dp" android:layout_height="50dp" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:background="#0f0f0f" android:text="top|horizontal" android:textColor="#ffffff" /> <TextView android:layout_width="50dp" android:layout_height="50dp" android:layout_alignParentLeft="true" android:layout_centerVertical="true" android:background="#00ffff" android:text="left|vertical" /> <TextView android:layout_width="50dp" android:layout_height="50dp" android:layout_alignParentRight="true" android:layout_centerVertical="true" android:background="#fffff0" android:text="right|vertical" /> <TextView android:layout_width="50dp" android:layout_height="50dp" android:layout_alignParentBottom="true" android:layout_centerHorizontal="true" android:background="#fff000" android:text="bottem|horizontal" /></RelativeLayout>
<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" > <!-- id:使用具体控件前提:@+id/在给控件声明新id时使用;@id/使用已有的id --> <!-- layout_toLeftOf:在哪个兄弟控件的左侧 --> <!-- layout_toRightOf:在哪个兄弟控件的右侧 --> <!-- layout_above:在哪个兄弟控件的上边 --> <!-- layout_below:在兄弟控件下边 --> <TextView android:id="@+id/centerTv" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerInParent="true" android:background="#000fff" android:text="center" android:textColor="#ffffff" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerVertical="true" android:layout_toLeftOf="@id/centerTv" android:text="left" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerVertical="true" android:layout_toRightOf="@id/centerTv" android:text="right" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_above="@id/centerTv" android:layout_centerHorizontal="true" android:text="top" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@id/centerTv" android:layout_centerHorizontal="true" android:text="bottem" /></RelativeLayout>
<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" > <!-- layout_alignLeft:相对于兄弟控件左对齐 --> <!-- layout_alignRight:相对于兄弟控件右对齐 --> <!-- layout_alignTop:相对于兄弟控件顶部对齐 --> <!-- layout_alignBottom:相对于兄弟控件底部对齐 --> <TextView android:id="@+id/centerTv" android:layout_width="50dp" android:layout_height="50dp" android:layout_centerInParent="true" android:background="#00ffff" android:text="center" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@id/centerTv" android:text="left" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_alignRight="@id/centerTv" android:text="right" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBottom="@id/centerTv" android:text="bottem" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_alignTop="@id/centerTv" android:text="top" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBaseline="@id/centerTv" android:layout_toRightOf="@id/centerTv" android:text="base" /></RelativeLayout>
0 0
- 关于Android 相对布局中的属性 的介绍和运用
- Android关于相对布局RelativeLayout的各种属性介绍
- 关于相对布局RelativeLayout的各种属性介绍
- 关于相对布局RelativeLayout的各种属性介绍
- 关于相对布局RelativeLayout的各种属性介绍
- 【安卓】关于相对布局RelativeLayout的各种属性介绍
- 关于相对布局RelativeLayout的各种属性介绍
- 关于相对布局RelativeLayout的各种属性介绍
- 关于相对布局RelativeLayout的各种属性介绍
- 关于相对布局RelativeLayout的各种属性介绍
- 【android学习笔记】关于相对布局RelativeLayout的各种属性介绍
- 【android学习笔记】关于相对布局RelativeLayout的各种属性介绍
- 【android学习笔记】关于相对布局RelativeLayout的各种属性介绍
- 【android学习笔记】关于相对布局RelativeLayout的各种属性介绍
- 【android学习笔记】关于相对布局RelativeLayout的各种属性介绍
- 【android学习笔记】关于相对布局RelativeLayout的各种属性介绍
- 【android学习笔记】关于相对布局RelativeLayout的各种属性介绍
- 【android学习笔记】关于相对布局RelativeLayout的各种属性介绍
- vim命令
- Android绘图之绘制太极图
- RMAN实战5:RMAN中恢复目录的使用和清理
- android之文件存储路径
- android 为layout添加点击事件以及封装onclicklistener工具类
- 关于Android 相对布局中的属性 的介绍和运用
- as为jar包关联源码
- xxtea加密算法-忘记是从哪里看到的了
- NodeJs oracledb无法完成删除数据项操作的处理方法
- 如何清空文件上传控件里的选定文件(路径)
- 自定义控件3---TextView
- 正则表达式 匹配000000至999999的六位数,不包含820666至820999
- liunx 常用命令
- MFC结构体的定义标准,可参考