Let's suppose I have the following composable:
Column(Modifier.fillMaxWidth()) {
Text()
Text()
Text()
}
I would like to know how I can capture the values of measuredWidth
and measuredHeight
of Column
.
Using Android View framework style, I could take advantages of the method onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int)
from View.
var width = 0
var hegiht = 0
Column(modifier = Modifier.onGloballyPositioned { layoutCoordinates ->
width = layoutCoordinates.size.width
hegiht = layoutCoordinates.size.height
}) {
// Column body
}