radzio
02/17/2021, 9:27 PMTextField
focus inside scrollable Column
.
I don't know how to scroll Column
to the selected/focused TextField
I've creates stackoverflow question too: https://stackoverflow.com/questions/66249829/jetpack-compose-scroll-to-focused-composable-in-column
Can someone tell me what is the best approach for this?
I don't need/want use LazyColumn (not so many TextFields)Timo Drick
02/17/2021, 11:31 PMradzio
02/18/2021, 6:58 AMradzio
02/18/2021, 8:35 AMonGloballyPositioned
and it works.
var scrollToPosition = 0.0F
TextField(
modifier = Modifier
.focusOrder(countryFocus)
.onGloballyPositioned { coordinates ->
scrollToPosition = scrollState.value + coordinates.positionInRoot().y
}
.onFocusChanged {
if (it == FocusState.Active) {
scope.launch {
scrollState.smoothScrollTo(scrollToPosition)
}
}
}
)
Sean McQuillan [G]
02/22/2021, 7:13 PMSean McQuillan [G]
02/22/2021, 7:13 PMAdam Powell
02/22/2021, 7:40 PMrequestChildRectOnScreen
equivalents. I'd try to scope the above to just the scrolling container rather than the global rootSean McQuillan [G]
04/09/2021, 3:27 AMSean McQuillan [G]
04/09/2021, 3:32 AMchris
04/09/2021, 4:05 AMAccess denied
Sean McQuillan [G]
04/09/2021, 3:16 PMSean McQuillan [G]
04/09/2021, 4:47 PM