How to set maxHeight over DimensionRatio with ConstraintLayout?
If you want to enforce max_height
and keep the dimension ratio at the same time, you need to constrain the width based on height. You can achieve that by adding W
to your ratio:
app:layout_constraintDimensionRatio="W,1220:1000"
This will constrain the height first and then set the width accordingly to satisfy the ratio.
More info on how this dimension ratio works can be found in the documentation.