I googled a bunch, but I couldn't find an answer to my question:
How do you get the layed out height (or width) of a Compose component?
I'd like to use the height of a LazyColunnFor to see if a ListItem is in the center of it (and scale it accordingly, based on how far away the ListItem is from that center).
y
Yann Badoual
10/07/2020, 7:04 AM
There's a
onSizeChanged
modifier that you can use, and store the result in a mutableState
👍 2
s
Se7eN
10/07/2020, 8:38 AM
Quick example:
Copy code
var height by remember { mutableStateOf(0) }
LazyColumnFor(
modifier = Modifier.onSizeChanged {
height = it.height
}
)