1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
| @Composable fun LazyRowDemo() { val list = listOf("A", "B", "C", "D") + ((0..20).map { it.toString() }) LazyRow(Modifier.fillMaxHeight()) { items( key = { list.get(it) }, count = list.size, itemContent = { item -> val content = list.get(item) Log.d("COMPOSE", "This get rendered ${content}") when (content) { "A" -> { Text(text = content, style = TextStyle(fontSize = 80.sp)) } "B" -> { Button(onClick = {}) { Text(text = content, style = TextStyle(fontSize = 80.sp)) } } "C" -> { } "D" -> { Text(text = content) } else -> { Text(text = content, style = TextStyle(fontSize = 80.sp)) } } } ) } }
|