第一种情况:控件宽度为0,高度为有效值
ConstraintLayout中的layout_constraintDimensionRatio属性
app:layout_constraintDimensionRatio="w,2:1"这行代码可以理解为以控件高度为基准,宽度的数值:高度的数值=2:1,即这里的宽度为200dp。效果图如下:
ConstraintLayout中的layout_constraintDimensionRatio属性
如果把layout_constraintDimensionRatio的值换成h,2:1,那么这行代码就理解为以控件高度为基准,高度的数值:宽度的数值=2:1,即这里的宽度为50dp。效果图如下:
ConstraintLayout中的layout_constraintDimensionRatio属性
可以看出layout_constraintDimensionRatio属性中的w/Wh/H代表的是后面分号前面的值

相关文章:

  • 2021-09-15
  • 2021-09-01
  • 2021-08-30
  • 2021-05-25
  • 2022-12-23
  • 2021-07-04
  • 2021-12-14
猜你喜欢
  • 2022-01-20
  • 2021-08-22
  • 2021-07-08
  • 2021-09-03
  • 2022-01-08
  • 2021-12-11
相关资源
相似解决方案