我想滚动到ScrollableColumn内的特定项目,但是如何在不猜测的情况下获取所需的初始scrollValue?
我希望滚动在可组合的TopAppBar结束之后开始
@ExperimentalMaterialApi
@Composable
fun Content(data: DataObj, onEditAction: () -> Unit) {
val items = listOf("a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "")
val scrollState = rememberScrollState(140f)
Surface(contentColor = Color.DarkGray) {
ScrollableColumn(scrollState = scrollState, modifier = Modifier.fillMaxSize()) {
TopAppBar(
title = { Text("Edit Entry") },
backgroundColor = Color.Transparent,
actions = {
IconButton(onClick = onEditAction) {
Icon(asset = Icons.Filled.Edit)
}
}
)
LazyColumnFor(items) { item ->
Surface(Modifier.preferredHeight(50.dp).fillMaxWidth()) {
Text(item)
}
}
}
}
}