Module中默认的布局就是ConstraintLayout。如下所示:

xmlns:android="http://schemas.android.com/apk/res/android"

xmlns:app="http://schemas.android.com/apk/res-auto"

xmlns:tools="http://schemas.android.com/tools"

android:layout_width="match_parent"

android:layout_height="match_parent"

tools:context="com.constraintlayout.app.Main2Activity">

在使用ConstraintLayout的布局方案,需要在build.gradle引入支持库:

dependencies{

compile'com.android.support.constraint:constraint-layout:1.0.1'}

具体使用:

http://blog.csdn.net/guolin_blog/article/details/53122387(郭神的博客)

http://www.jianshu.com/p/a8b49ff64cd3

常用方法总结

layout_constraintTop_toTopOf// 将所需视图的顶部与另一个视图的顶部对齐。

layout_constraintTop_toBottomOf// 将所需视图的顶部与另一个视图的底部对齐。

layout_constraintBottom_toTopOf// 将所需视图的底部与另一个视图的顶部对齐。

layout_constraintBottom_toBottomOf// 将所需视图的底部与另一个视图的底部对齐。

layout_constraintLeft_toTopOf// 将所需视图的左侧与另一个视图的顶部对齐。

layout_constraintLeft_toBottomOf// 将所需视图的左侧与另一个视图的底部对齐。

layout_constraintLeft_toLeftOf// 将所需视图的左边与另一个视图的左边对齐。

layout_constraintLeft_toRightOf// 将所需视图的左边与另一个视图的右边对齐。

layout_constraintRight_toTopOf// 将所需视图的右对齐到另一个视图的顶部。

layout_constraintRight_toBottomOf// 将所需视图的右对齐到另一个的底部。

layout_constraintRight_toLeftOf// 将所需视图的右边与另一个视图的左边对齐。

layout_constraintRight_toRightOf// 将所需视图的右边与另一个视图的右边对齐。

表示wrap content

表示固定值,也就是给控件指定了一个固定的长度或者宽度值。

表示any size,它有点类似于match parent,但和match parent并不一样,是属于ConstraintLayout中特有的一种大小控制方式,any size就是用于在ConstraintLayout中顶替match parent.

更多相关文章

  1. Android布局之LinearLayout
  2. 线性布局LinearLayout和相对布局RelativeLayout 比较
  3. android界面布局
  4. ViewGroup常用布局操作
  5. Android 控件之DatePicker,TimePicker,Calender
  6. Android基础之基本控件
  7. android 获取控件真实高度
  8. android LinearLayout布局子空间没有填充父控件的问题

随机推荐

  1. bootstrap-treeview 扩展addNode方法 动
  2. 在地下交易中,个人信息到底有多少价值?
  3. echart hightchart 区别
  4. The hierarchy of the type is inconsist
  5. 百万Echo和Kindle设备受到Wifi漏洞影响
  6. 电子竞技行业所面临的四大***威胁
  7. 三星Galaxy S10指纹识别被硅胶套破解
  8. HugePages 大内存页
  9. 对物联网出勤设备的***测试总结
  10. Caused by: Java.lang.NoSuchMethodError