需要另一个view的id或者父容器即ConstraintLayout
- app:layout_constraintTop_toTopOf="@id/view | parent"
- app:layout_constraintTop_toBottomOf="@id/view | parent"
- app:layout_constraintRight_toLeftOf="@id/view | parent"
- app:layout_constraintRight_toRightOf="@id/view | parent"
- app:layout_constraintBottom_toBottomOf="@id/view | parent"
- app:layout_constraintBottom_toTopOf="@id/view | parent"
- app:layout_constraintLeft_toLeftOf="@id/view | parent"
- app:layout_constraintLeft_toRightOf="@id/view | parent"
- app:layout_constraintStart_toStartOf="@id/view | parent"
- app:layout_constraintStart_toEndOf="@id/view | parent"
- app:layout_constraintEnd_toStartOf="@id/view | parent"
- app:layout_constraintEnd_toEndOf="@id/view | parent"
- app:layout_constraintVertical_bias="0.0 ~ 正无穷" (大于等于 1.0 则为1.0)
- app:layout_constraintHorizontal_bias="0.0 ~ 正无穷" (大于等于 1.0 则为1.0)
宽高比(约束宽度或者高度为另一方的x/x,默认为宽度)
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintDimensionRatio="H,16:9" * app:layout_constraintDimensionRatio="W,16:9"
Guide(引导线)
- layout_constraintGuide_begin="100dp"
- layout_constraintGuide_end="100dp"
- layout_constraintGuide_percent="0.0~正无穷"
注意使用layout_constraintGuide_percent,
layout_constraintGuide_begin和layout_constraintGuide_end都会失效
忽略Gone
- layout_goneMarginStart
- layout_goneMarginEnd
- layout_goneMarginLeft
- layout_goneMarginTop
- layout_goneMarginRight
- layout_goneMarginBottom
为什么没有layout_goneMargin忽略全部呢?