ConstraintLayout布局的使用总结

本文探讨了Android开发中强大的ConstraintLayout布局,它是RelativeLayout的增强版,融合多种布局优点。文章介绍了如何引入并使用基本属性,如layout_constraintTop_toTopOf等实现视图对齐,同时讲解了设置margin、bias偏移量以及环形定位的方法,为开发者提供实用的布局技巧。
摘要由CSDN通过智能技术生成

本文根据本人学习和使用记录的内容。
ConstraintLayout,比较牛逼的一种布局,结合了其他几种布局的优点,也可以看做RelativeLayout的升级版。
使用ConstraintLayout需要引入:

implementation 'com.android.support.constraint:constraint-layout:1.1.3'

首先很重要也是很基础的几个属性

app:layout_constraintTop_toTopOf="@id/id2"
app:layout_constraintTop_toBottomOf="@id/id2"
app:layout_constraintLeft_toLeftOf="@id/id2"
app:layout_constraintLeft_toRightOf="@id/id2"
app:layout_constraintRight_toLeftOf="@id/id2"
app:layout_constraintRight_toRightOf="@id/id2"
app:layout_constraintBottom_toTopOf="@id/id2"
app:layout_constraintBottom_toBottomOf="@id/id2"
app:layout_constraintBaseline_toBaselineOf="@id/id2"
app:layout_constraintStart_toEndOf="@id/id2"
app:layout_constraintStart_toStartOf="@id/id2"
app:layout_cons
  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值