学习Layout总结

一、RelativeLayout(相对布局)
相对布局有两种,一种是相对容器而言,另一种是相对控件而言。
*下面是对控件的一种

<ImageViewandroid:layout_width="100dp"android:layout_height="100dp"app:srcCompat="@drawable/smile1"android:id="@+id/imageView"android:layout_centerInParent="true"/><ImageViewandroid:layout_width="50dp"android:layout_height="50dp"app:srcCompat="@drawable/rabbit4"android:layout_below="@+id/imageView"android:layout_alignLeft="@+id/imageView2"android:layout_alignStart="@+id/imageView2"android:layout_marginTop="24dp"android:id="@+id/imageView3" /><ImageViewandroid:layout_width="50dp"android:layout_height="50dp"app:srcCompat="@drawable/rabbit2"android:layout_alignTop="@+id/imageView4"android:layout_toRightOf="@+id/imageView"android:layout_toEndOf="@+id/imageView"android:layout_marginLeft="33dp"android:layout_marginStart="33dp"android:id="@+id/imageView5" /><ImageViewandroid:layout_width="50dp"android:layout_height="50dp"app:srcCompat="@drawable/rabbit1"android:id="@+id/imageView4"android:layout_centerVertical="true"android:layout_toLeftOf="@+id/imageView"android:layout_toStartOf="@+id/imageView"android:layout_marginRight="41dp"android:layout_marginEnd="41dp" /><ImageViewandroid:layout_width="50dp"android:layout_height="50dp"app:srcCompat="@drawable/rabbit3"android:id="@+id/imageView2"android:layout_marginBottom="25dp"android:layout_above="@+id/imageView"android:layout_alignLeft="@+id/imageView"android:layout_alignStart="@+id/imageView"android:layout_marginLeft="13dp"android:layout_marginStart="13dp" />

二、LinearLayout(线性布局)
*在UI开发中,线性布局默认为水平显示,如果想要设置垂直,用属性orientation;
*weight表示权重
*控件布局中对齐方式用layout_gravity,文字在布局中对齐方式用gravity

<EditTextandroid:layout_width="match_parent"android:layout_height="match_parent"android:background="#000000"android:layout_weight="1"android:layout_marginTop="10dp"/><EditTextandroid:layout_width="match_parent"android:layout_height="match_parent"android:background="#ababab"android:layout_weight="1"android:layout_marginTop="10dp"/><EditTextandroid:layout_width="match_parent"android:layout_height="match_parent"android:background="#0000ff"android:layout_weight="1"android:layout_marginTop="10dp"/>
<EditTextandroid:layout_width="match_parent"android:layout_height="match_parent"android:background="#00ff00"android:layout_weight="1"android:layout_marginTop="10dp"/><EditTextandroid:layout_width="match_parent"android:layout_height="match_parent"android:background="#ff0000"android:layout_weight="1"android:layout_marginTop="10dp"/>

三、TableLayout(表格布局)
*每一行用TableRow

<TableRow
>
<EditText android:layout_width="wrap_content"android:layout_height="wrap_content"android:text="Account:"/>
<TextView android:layout_width="match_parent"android:layout_height="match_parent"android:hint="Input  your  account"android:gravity=""android:layout_weight="1"/>
</TableRow><TableRow><EditText android:layout_width="wrap_content"android:layout_height="wrap_content"android:text="Password:"/><TextView android:layout_width="match_parent"android:layout_height="match_parent"android:layout_weight="1"/>
</TableRow><TableRow><Buttonandroid:layout_width="match_parent"android:layout_height="wrap_content"android:text="Login"android:layout_weight="1"android:id="@+id/button" />
</TableRow>

四、GridLayout(网格布局)

五、FrameLayout(帧布局)
*帧布局在局面上是一帧一帧显示的;
*帧布局在子控件默认是左上角对齐;

<Buttonandroid:text="Button1"android:layout_width="100dp"android:layout_height="100dp"android:id="@+id/button" /><Buttonandroid:text="Button2"android:layout_width="80dp"android:layout_height="80dp"android:id="@+id/button2" />

六、AbsoluteLayout(相对布局)
*可以确定准确的坐标值,代码是:
android:laoyout_x 确定水平的位置;
android:laoyout_y 确定竖直的位置;

以上就是我对六个布局的了解,希望以后更深入了解。

学习Layout总结相关推荐

  1. 【工作日志】elementUI学习-Layout布局

    Layout布局 1.创建布局 通过Col组件的:span属性调整Layout布局,分为24栏. el-row><el-col :span="24"><di ...

  2. 一、前端入门学习-layout(布局)(3)

    一.文档流 <!DOCTYPE html> <html lang="en"> <head><meta charset="UTF- ...

  3. 【工作日志】elementUI学习-Layout布局-2

    CheckBox复选框 1.基本用法 按钮是单一时,绑定v-model变量,类型为boolean值. <template><!-- `checked` 为 true 或 false ...

  4. 一牛网:PCB layout设计培训:免费试听,可预约报名

    前言: 电子产业得到了飞速发展,人们的工作生活和各种电子产品密不可分.而作为电子产品不可缺少的重要载体-PCB,也扮演了日益重要的角色.电子设备呈现高性能.高速.轻薄的趋势,PCB作为多学科行业已成为 ...

  5. android Auto animate layout updates

    准备花一段时间把Android官方文档翻译下, 系统的学习下,今天学习layout布局文件自动添加动画 https://developer.android.google.cn/training/ani ...

  6. 学习 kityminder 笔记(十)

    2019独角兽企业重金招聘Python工程师标准>>> 今天学习 layout 下的各个 js. 在此之前, 需要回顾一下 core/layout. 注意在 core 下面有 lay ...

  7. Android 中View的绘制机制源代码分析 三

    到眼下为止,measure过程已经解说完了,今天開始我们就来学习layout过程.只是在学习layout过程之前.大家有没有发现我换了编辑器,哈哈.最终下定决心从Html编辑器切换为markdown编 ...

  8. Android 布局学习之——Layout(布局)详解一

    layout(布局)定义了用户界面的可视化结构(visual structure),如Activity的UI,应用窗口的UI. 有两种方式声明layout: 1.在xml文件中声明UI组件. 2.在运 ...

  9. android线性布局快捷键,【整理】Android图形界面知识学习与总结之:Linear Layout线性布局...

    [背景] 之前已经学习了: 现在接着去学习: 整理如下: Linear Layout 1.LinearLayout是一个视图组合 2.LinearLayout中的子视图只能已单个方向排列,要么是水平, ...

最新文章

  1. 又有六所大学考研预调剂系统已开放!
  2. linux中生成考核用的FAT32文件系统结构样例(一)
  3. Nginx学习笔记---ngx_table_elt_t数据结构
  4. ubuntu上安装python3.7教程_Day1: 如何在ubuntu 18.04中升级python 3.6到3.7
  5. 今天微信没有520红包 大家可以放心了!
  6. Zabbix(七)zabbix proxy 分布式监控配置
  7. 用好Windows 7自带文件加密工具
  8. PCWorld测评的2012版世界级杀毒软件
  9. 联想笔记本进BIOS
  10. 【RDMA】ibv 函数和相关问题|IBV_SEND_INLINE
  11. pytorch to_device遇到数据迁移不成功的问题
  12. zoj 2343 Robbers 【贪心】
  13. 仙剑3安卓移植版_仙剑奇侠传3安卓版
  14. dreamweaver网页设计作业制作 (NBA篮球网页设计与制作) HTML+CSS
  15. OneNote中如何输入数学公式
  16. 2022-2027年中国海洋油气开采行业市场全景评估及发展战略规划报告
  17. 诗经 - 小雅 - 出车
  18. 关于Tomcat服务器无法打开tomcat7w.exe的解决办法
  19. 误操作清空了回收站文件如何找到文件
  20. 淘宝api开放平台买家卖家订单接口,python网络爬虫采集数据

热门文章

  1. deepin系统使用ifconfig -a 输出参数详细介绍
  2. 如何选购汽车线束检测仪,需要考虑哪些因素
  3. 车辆结构——轮胎模型学习
  4. [vue移动端项目] 严选商城项目 使用vue+vant做的移动端商城小项目
  5. 计算机毕业设计ssm东方医院预约挂号系统sj6ck系统+程序+源码+lw+远程部署
  6. flask markdown 报错解决
  7. 有关Google nexus7 连接PC后MTP无法识别的问题(系统是android 4.3)
  8. bilibili如何空降
  9. 大学计算机基础万维考试题库,大学计算机基础考试题库-20210614012802.docx-原创力文档...
  10. 10个最顶尖的专业服装设计软件(外国)