一、LinearLayout—线性布局

首先是最基本的,所有布局都有的属性:
android:layout_width=“wrap_content” //wrap_content 包裹内容
android:layout_height=“match_parent” //match_parent 填充父容器

其次,进入线性布局:
android:orientation=“vertical”
//这是设置布局中控件排列方式的
//vertical 垂直摆放
//horizontal 水平摆放

还有gravity //内部控件的对齐方式

gravity中不常见的:
android:layout_gravity=“fill_horizontal” //必要时增加对象横向大小
android:layout_gravity=“fill_vertical” //必要时增加对象竖向大小

二、RelativeLayout—相对布局

android:layout_alignParentTop="true"  //指定是否与父布局顶部对齐,值为"true"或"false"。android:layout_alignParentBottom="true"  //指定是否与父布局底部对齐,值为"true"或"false"。android:layout_alignParentRight="true"  //指定是否与父布局右对齐,值为"true"或"false"。android:layout_alignParentLeft="true"  //指定是否与父布局左对齐,值为"true"或"false"。android:layout_above  //属性值取为其他控件的id,指定控件的上方。android:layout_below   //属性值取为其他控件的id,指定控件的下方。android:layout_toLeftOf   //属性值取为其他控件的id,指定控件的左方。android:layout_toRightOf   //属性值取为其他控件的id,指定控件的右方。android:layout_alignTop   //属性值取为其他控件的id,指定控件的顶部对齐。android:layout_alignBottom   //属性值取为其他控件的id,指定控件的底部对齐。android:layout_alignLeft   //属性值取为其他控件的id,指定控件的左对齐。android:layout_alignRight   //属性值取为其他控件的id,指定控件的右对齐。android:layout_marginRight="20dp"  //与父布局右边相距android:layout_marginLeft="20dp"  //与父布局左边相距android:layout_marginTop="20dp"  //与父布局上边相距android:layout_marginBottom="20dp"  //与父布局下边相距android:layout_marginStart="20dp"  //与父布局下边相距,与Left的区别在于左边是否为开头android:layout_marginBottom="20dp"  //与父布局下边相距,同Startandroid:layout_centerInParent="true"  //与父布局水平垂直都居中android:layout_centerHorizontal="true"  //与父布局水平居中android:layout_centerVertical="true"  //与父布局垂直居中

在绝对布局中衍生出了一个增强的相对布局—ConstrainLayout,现如今有流行趋势。

三、FrameLayout—帧布局

后覆盖前

前三个为主要的三个布局

四、AbsoluteLayout—绝对布局

android:layout_x="60dp"    android:layout_y="60dp"//利用坐标定位

五、TableLayout—表格布局

android:stretchColumns="2"//用来设置TableLayout的子标签TableRow的某列是否拉伸,相应的有shrinkColumns  设置收缩。android:layout_column//指定该单元格在第几列显示android:layout_span//指定该单元格占据的列数

六、GridLayout—网格布局

android:rowCount="6"//设置行数android:columnCount="4"//设置列数android:layout_columnSpan="2"//设置占几列android:layout_rowSpan="2"//设置占几行

更多相关文章

  1. Android(安卓)xml资源文件中@、@android:type、@*、?、@+含义和区
  2. Android基本布局-RelativeLayout
  3. Android布局属性
  4. android 设置系统自带字体
  5. layout布局属性
  6. android 入门xml布局文件
  7. android 入门xml布局文件
  8. 今天开始记录自学android的历程
  9. Android(安卓)Studio Android(安卓)UI控件学习笔记

随机推荐

  1. Android(安卓)约束布局(ConstraintLayout)
  2. android 周报 - 2019/10/6-Issue #382
  3. android 图片处理工具类,Bitmap转换String
  4. android 项目中设置背景图片
  5. 4.0 以上插耳机让音乐在耳机播放,屏蔽掉
  6. 一段漂亮的Fragment hide,show相关的代码
  7. RxJava操作符在android中的使用场景详解(
  8. Android(安卓)Toast 部分手机无法显示问
  9. Android(安卓)RemoteViews原理
  10. Android代码混淆proguard技…