【发布时间】:2021-01-31 15:52:43
【问题描述】:
我有一个带有 2 个单元格的 LazyVerticalGrid。
LazyVerticalGrid(
cells = GridCells.Fixed(2),
content = {
items(moviePagingItems.itemCount) { index ->
val movie = moviePagingItems[index] ?: return@items
MovieItem(movie, Modifier.preferredHeight(320.dp))
}
renderLoading(moviePagingItems.loadState)
}
)
我正在尝试使用LazyGridScope 的fillParentMaxSize 修饰符显示全宽度加载。
fun LazyGridScope.renderLoading(loadState: CombinedLoadStates) {
when {
loadState.refresh is LoadState.Loading -> {
item {
LoadingColumn("Fetching movies", Modifier.fillParentMaxSize())
}
}
loadState.append is LoadState.Loading -> {
item {
LoadingRow(title = "Fetching more movies")
}
}
}
}
但是由于我们有 2 个单元格,加载可以占据屏幕的一半。像这样:
有没有办法让我的加载视图占据整个宽度?
【问题讨论】:
标签: android android-jetpack-compose