RelativeLayout相对布局
来源:互联网 发布:淘宝女模特好漂亮 编辑:程序博客网 时间:2024/06/03 14:51
RelativeLayout相对布局
RelativeLayout相对布局是个人觉得在android布局中比较常用且好用的一个,当然如果想让布局更漂亮是需要多种布局混合搭建的,这里就需要更深入的学习了,在这只介绍下有关相对布局的东西。
相对于兄弟元素
android:layout_below=”@id/aaa”:在指定View的下方
android:layout_above=”@id/xxx”:在指定View的上方
android:layout_toLeftOf=”@id/bbb”:在指定View的左边
android:layout_toRightOf=”@id/cccc”:在指定View的右边
相对于父元素
android:layout_alignParentLeft=”true”:在父元素内左边
android:layout_alignParentRight=”true”:在父元素内右边
android:layout_alignParentTop=”true”:在父元素内顶部
android:layout_alignParentBottom=”true”:在父元素内底部
对齐方式
android:layout_centerInParent=”true”:居中布局
android:layout_centerVertical=”true”:水平居中布局
android:layout_centerHorizontal=”true”:垂直居中布局
android:layout_alignTop=”@id/xxx”:与指定View的上边界一致
android:layout_alignBottom=”@id/xxx”:与指定View下边界一致
android:layout_alignLeft=”@id/xxx”:与指定View的左边界一致
android:layout_alignRight=”@id/xxx”:与指定View的右边界一致
间隔
android:layout_marginBottom=”“; 离某元素底边缘的距离
android:layout_marginLeft=”“; 离某元素左边缘的距离
android:layout_marginRight =”“;离某元素右边缘的距离
android:layout_marginTop=”“; 离某元素上边缘的距离
android:layout_paddingBottom=”“; 离父元素底边缘的距离
android:layout_paddingLeft=”“; 离父元素左边缘的距离
android:layout_paddingRight =”“;离父元素右边缘的距离
android:layout_paddingTop=”“; 离父元素上边缘的距离
<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"> <RelativeLayout android:layout_width="190dp" android:layout_height="190dp"> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="1" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="2" android:layout_centerInParent="true" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="3" android:layout_alignParentRight="true" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="4" android:layout_alignParentBottom="true" android:layout_alignParentRight="true" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="5" android:layout_alignParentBottom="true" /> </RelativeLayout></RelativeLayout>
- RelativeLayout 相对布局
- 相对布局(RelativeLayout)
- RelativeLayout相对布局
- RelativeLayout相对布局
- RelativeLayout相对布局
- RelativeLayout相对布局
- 关于相对布局RelativeLayout
- Android 相对布局:RelativeLayout
- android 相对布局RelativeLayout
- android 相对布局 RelativeLayout
- 浅谈RelativeLayout相对布局
- RelativeLayout相对布局
- RelativeLayout相对布局学习
- RelativeLayout相对布局
- RelativeLayout相对布局
- RelativeLayout(相对布局)
- 相对布局 relativelayout
- RelativeLayout 相对布局
- SSH物流开发系统设计:业务人员的增删改查
- windows下配置mycat,实现mysql数据库的读写分离!
- POJ-1201 (差分约束系统)
- SpringMVC 拦截器
- 分享一個svg圖標生成工具
- RelativeLayout相对布局
- Android_布局2
- SQLite的Python编程
- NS3 network number confusion, 网络号混淆
- QT太多的内容和模块,怎么办?
- PermissionError: [Errno 13] in python
- mac上安装tensorflow的几个坑
- Python 使用 ElementTree 模块来处理 XML
- centos 7,局域网不能访问禅道