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. windows下载android源代码
  2. Android的常用adb命令
  3. Android(安卓)用MediaCodec实现视频硬解
  4. Android:只读EditText内容可滚动(禁止输
  5. Android虚拟机大屏幕设置
  6. Android(安卓)蓝牙状态机以及蓝牙启动状
  7. Android事件分发机制
  8. android 流量统计实现思路
  9. Tiny210(Android)串口收发测试通过
  10. android菜单Tips