Android ConstraintLayout的使用(二)

https://www.jianshu.com/p/502127a493fb

https://www.jianshu.com/p/f110b4fcfe93

View 的尺寸

app:layout_constraintWidth_default

有三个值

spread,当layout_width设置为0dp的时候,View会在约束的方向扩张。

percent  需要设置

layout_constraintWidth_percent

比如为0.4,该View 的宽度就是父View的0.4倍。

设置View 的宽高比

其中一个设置为0dp,

然后app:layout_constraintDimensionRatio="2:1"

原文地址:https://www.cnblogs.com/noigel/p/12368763.html