1.Relative positioning
layout_constraintLeft_toLeftOf 我的左侧与你的左侧对齐
layout_constraintLeft_toRightOf 我的左侧与你的右侧对齐
layout_constraintRight_toLeftOf 我的右侧与你的左侧对齐
layout_constraintRight_toRightOf 我的右侧与你的右侧对齐
layout_constraintTop_toTopOf 我的顶部与你的顶部对齐
layout_constraintTop_toBottomOf 我的顶部与你的底部对齐 (相当于我在你下面) layout_constraintBottom_toTopOf
layout_constraintBottom_toBottomOf
layout_constraintBaseline_toBaselineOf 基线对齐
layout_constraintStart_toEndOf 我的左侧与你的右侧对齐
layout_constraintStart_toStartOf
layout_constraintEnd_toStartOf
layout_constraintEnd_toEndOf
2.与父亲边缘对齐
app:layout_constraintBottom_toBottomOf="parent" 我的底部与父亲底部对齐 app:layout_constraintTop_toTopOf="parent" 我的顶部与父亲的顶部对齐 app:layout_constraintLeft_toLeftOf="parent" 我的左侧与父亲的左侧对齐 app:layout_constraintRight_toRightOf="parent" 我的右侧与父亲的右侧对齐
3.居中
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent" =竖直居中。。。水平居中,中心同理
4.Bias(偏向某一边)
layout_constraintHorizontal_bias 水平约束力
layout_constraintVertical_bias 垂直约束力 注意:范围(0-1)
5.边距
android:layout_marginStart
android:layout_marginEnd
android:layout_marginLeft
android:layout_marginTop
android:layout_marginRight
android:layout_marginBottom 注意:设置相关的方向的约束后,相关的边距才会生效
6.Circular positioning (Added in 1.1)
layout_constraintCircle :引用另一个小部件ID
layout_constraintCircleRadius :到其他小部件中心的距离
layout_constraintCircleAngle :小部件应该处于哪个角度(以度为单位,从0到360)
7.Visibility behavior 可见性行为
android:visibility : 注意:设置为gone,可以把它当做一个点(这个view所有的margin都将失效).
8.Dimensions constraints 尺寸限制
android:minWidth 设置布局的最小宽度
android:minHeight 设置布局的最小高度
android:maxWidth 设置布局的最大宽度
android:maxHeight 设置布局的最大高度 注意:只有宽度或高度为wrap_content时才会生效
9.Widgets dimension constraints 宽高约束
1-使用指定长度,
2-使用wrap_content,view计算自己的大小
3-使用0dp,相当于“ MATCH_CONSTRAINT” 注:理解为约束范围内的全部空间,缺少相应约束即0
10.WRAP_CONTENT:强制约束(在1.1中添加)
app:layout_constrainedWidth=”true|false”
app:layout_constrainedHeight=”true|false” 注:解决当一个view的宽或高,设置成wrap_content时,如果里面的内容实在特别宽的时候,他的约束会出现问题
11.MATCH_CONSTRAINT尺寸(在1.1中添加)
layout_constraintWidth_min和layout_constraintHeight_min:将设置此维度的最小大小 layout_constraintWidth_max和layout_constraintHeight_max:将设置此维度的最大大小 layout_constraintWidth_percent和layout_constraintHeight_percent:将此维度的大小设置为父级的百分比 注:即0dp相关扩展,范围(0-1)
12.其他
app:layout_constraintDimensionRatio 宽高比 注:需要将至少一个约束维度设置为0dp
app:layout_optimizationLevel="standard|dimensions|chains"
13.Chains(链)
app:layout_constraintHorizontal_chainStyle (packed| spread_inside|spread)
app:layout_constraintHorizontal_chainStyle
app:layout_constraintHorizontal_weight 注:类似权重
14.虚拟式图
guideline:辅助线
android:orientation 方向
layout_constraintGuide_begin 距离父亲起始位置的距离(左侧或顶部)
layout_constraintGuide_end 距离父亲结束位置的距离(右侧或底部) layout_constraintGuide_percent 距离父亲宽度或高度的百分比(取值范围0-1)
barrier:屏障
app:barrierDirection 方向
app:constraint_referenced_ids 依赖控件,可组 注:组最
Group:实行多个隐藏显示
app:constraint_referenced_ids 依赖控件,可组
注: setVisibility()为空方法,该View就永远为GONE了
draw()方法为空,意思是不用去绘画.
onMeasure()中将自己长宽设置成0.