使用Paging3时保存并保留LazyColumn滚动位置
我在我的活动中使用 Paging 3 Library with Lazy Column 和 BottomNavigation Menu。附加到 BottomNavMenu 的每个可组合屏幕都使用一个可组合,而后者又使用惰性列。当我使用 compose 导航库在可组合物之间导航时,我希望重新组合的可组合物保留滚动位置和 lazyListState
我尝试了以下但不起作用:
val listState = rememberLazyListState()
val scrollState = rememberScrollState()
LazyColumn(
modifier = Modifier
.fillMaxSize()
.padding(bottom = 56.dp)
.scrollable(scrollState, Orientation.Vertical),
state = listState,
) {
//draw the items and hook the loadState to the lazy paging items
每次我导航到这个可组合时,它都会重新组合,滚动位置设置为 0,这不是我想要的。处理这个问题的正确方法是什么