Jan
06/04/2022, 10:49 PMLazyVerticalGrid(
columns = GridCells.Adaptive(246.dp),
contentPadding = PaddingValues(
start = 12.dp,
top = 16.dp,
end = 12.dp,
bottom = 16.dp
),
content = {
items(result.size) { index ->
//draw item
}
}
)
}
Now the scroll state of the grid is always like in the end or in the middle so it doen't start at the top and I don't know why.
Also how to save the scroll state when the lazyverticalgrid leaves the composition?Dragos Rachieru
06/06/2022, 7:09 AMval state = rememberLazyGridState()
Pass the state:
LazyVerticalGrid(
state = state,
columns = GridCells.Adaptive(246.dp),
contentPadding = PaddingValues(
start = 12.dp,
top = 16.dp,
end = 12.dp,
bottom = 16.dp
),
content = {
items(result.size) { index ->
//draw item
}
}
)
}
Dragos Rachieru
06/06/2022, 7:10 AM