添加依赖
compile 'com.android.support.constraint:constraint-layout:1.0.2'
创建布局
复制代码
需要了解的地方
- 宽度为0dp
android:layout_width="0dp"
- 需要准确指定左右的约束
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@+id/bt_b"//使用@id 编译不通过,使用@+id就可以了
- 指定权重
app:layout_constraintHorizontal_weight="1"
- 约束也可以为
parent
app:layout_constraintBottom_toBottomOf="parent"