ConstraintLayout 的用法

1、app:layout_constraintLeft_toLeftOf
//Constrains the left side of a child to the left side of a target child (contains the target child id).
表示此控件的左边框与某个控件的左边框对齐或者在其右边
在这里插入图片描述

2、app:layout_constraintLeft_toRightOf
//Constrains the left side of a child to the right side of a target child (contains the target child id).
表示此控件的左边框与某个控件的右边框对齐或者在其右边
在这里插入图片描述

3、app:layout_constraintRight_toLeftOf
//Constrains the right side of a child to the left side of a target child (contains the target child id).
表示此控件的右边框与某个控件的左边框对齐或在其左边

在这里插入图片描述

4、app:layout_constraintRight_toRightOf
//Constrains the right side of a child to the right side of a target child (contains the target child id).
表示此控件的右边框与某个控件的右边框对齐或在其左边

在这里插入图片描述

5、app:layout_constraintTop_toTopOf
//Constrains the top side of a child to the top side of a target child (contains the target child id).
表示此控件的顶部边框与某个控件的顶部边框水平对齐或在其下边

在这里插入图片描述

6、app:layout_constraintTop_toBottomOf
//Constrains the top side of a child to the bottom side of a target child (contains the target child id).
表示此控件的顶部边框与某个控件的底部边框水平对齐或在其下边

在这里插入图片描述

7、app:layout_constraintBottom_toTopOf
//Constrains the bottom side of a child to the top side of a target child (contains the target child id).
表示此控件的底部边框与某个控件的顶部边框水平对齐或其上边

在这里插入图片描述

8、app:layout_constraintBottom_toBottomOf
//Constrains the bottom side of a child to the bottom side of a target child (contains the target child id).
表示此控件的底部边框与某个控件的底部边框水平对齐或其上边

在这里插入图片描述

9、app:layout_constraintBaseline_toBaselineOf
//Constrains the baseline of a child to the baseline of a target child (contains the target child id).
表示此控件与某个控件水平对齐

在这里插入图片描述

还有其它的一些属性
app:layout_constraintStart_toEndOf
意思就是 Button 的开始部分(从左往右看,开始部分就是 Button 的左边)与 ImageView 的右边是对齐的。
app:layout_constraintStart_toStartOf
这个就是说 Button 的左边与 ImageView 的左边是对齐的
不知道为什么上面已经出的属性能够满足布局需要了,为什么还要再出 start 和 end 的。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值