Programmatically change ConstraintSet attribute in motion scene of MotionLayout
What you can do is access the ConstraintSet
and then set the ratio:
motionLayout.getConstraintSet(R.id.start)?.let { startConstraintSet ->
val ratio = imageView.calculateRatio()
startConstraintSet.setDimensionRatio(R.id.top_image_container, ratio)
// You can set the width and height here as well
}