theapache64
parentLayoutCoordinates.size
0 x 0
@Composable fun Test1() { LazyRow { items(100) { id -> Box( modifier = Modifier .padding(end = 10.dp) .size(100.dp) .background(Color.Red) .onGloballyPositioned { layoutCoordinates -> println("$id -> parentSize: ${layoutCoordinates.parentLayoutCoordinates?.size}") } ){ Text("$id") } } } }
0 -> parentSize: 0 x 0 1 -> parentSize: 0 x 0 2 -> parentSize: 0 x 0 3 -> parentSize: 0 x 0 4 -> parentSize: 0 x 0 5 -> parentSize: 0 x 0 6 -> parentSize: 1080 x 263 7 -> parentSize: 1080 x 263 8 -> parentSize: 1080 x 263 9 -> parentSize: 1080 x 263 ... (printing size for rest of the items)
size
Andrey Kulikov
A modern programming language that makes developers happier.