Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
@Composable
fun FixedLazyGrid() {
val colors = remember {
listOf(Color.Yellow, Color.LightGray, Color.Cyan)
}
LazyVerticalGrid(
columns = GridCells.Fixed(5),
content = {
for (i in 0..20) {
item {
Box(
modifier = Modifier
.width(100.dp)
.height(60.dp)
.background(colors[i % 3])
) {
Text("Item $i", modifier = Modifier.padding(4.dp))
}
}
}
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment