Francois Morvillier
03/22/2021, 6:40 PMKirill Grouchnikov
03/22/2021, 6:57 PMFrancois Morvillier
03/22/2021, 7:32 PMval scrollState = rememberScrollState()
val selectedIndex = // compute the selected child index using scrollState.value and child layout info
Row(modifier = Modifier.horizontalScroll(scrollState)) {
// children declarations
for(i in 1..N) {
Child(i, selectedIndex)
}
}
The question is how to I get the layout positions of the children so I can compute selectedIndex?Kirill Grouchnikov
03/22/2021, 10:17 PMState
variable at the parent level which is updated in your measure pass.Kirill Grouchnikov
03/22/2021, 10:17 PMFrancois Morvillier
03/22/2021, 11:01 PM