当我启动我的应用程序时,如何让 lazyRow 转到最后一个索引?
答案 0 :(得分:2)
logconfig_dict = {
"version": 1,
"disable_existing_loggers": False,
"handlers": {
"console": {"class": "logging.StreamHandler", "level": "INFO"},
"null": {"class": "logging.NullHandler"},
},
"loggers": {
"gunicorn.error": {"level": "INFO", "propagate": False, "handlers": ["console"]},
"gunicorn.access": {"level": "INFO", "propagate": False, "handlers": ["null"]},
},
}
有关更多信息,请参阅文档here
你可以对 LazyRow 做同样的事情
答案 1 :(得分:0)
您可以使用方法animateScrollToItem
:
类似于:
val itemsList = //... your list
val listState = rememberLazyListState()
// Remember a CoroutineScope to be able to launch
val coroutineScope = rememberCoroutineScope()
LazyColumn(state = listState) {
items(itemsList){
Text( "Item $it" )
}
}
要自动启动,您可以使用:
DisposableEffect(Unit) {
coroutineScope.launch {
listState.animateScrollToItem(index = itemsList.size-1)
}
onDispose { }
}