The LazyColumn
wraps the height of the content and can be stretched and in this way the item
scope has constraints.maxHeight = Constraints.Infinity
. The sum of the rows' height in the LazyHorizontalGrid
can't be Constraints.Infinity
. It is the reason of the issue.
You have to assign a max height
to your LazyHorizontalGrid
.
LazyColumn {
item {
LazyHorizontalGrid(
rows = GridCells.Fixed(3),
horizontalArrangement = Arrangement.spacedBy(16.dp),
verticalArrangement = Arrangement.spacedBy(16.dp),
modifier = Modifier.heightIn(max = 200.dp)
) {
// item content
}
}
items(itemsList) {
item content
}
}
