Component - LazyColumn for lists
The LazyColumn is a scrollable vertical list in Android using Jetpack Compose. It only creates the visible items on screen, which helps apps run smoothly even with long lists.
The LazyColumn is a scrollable vertical list in Android using Jetpack Compose. It only creates the visible items on screen, which helps apps run smoothly even with long lists.
LazyColumn ├── Item 0: Text ├── Item 1: Text ├── Item 2: Text ├── ... └── Item N: Text
LazyColumn in Android Jetpack Compose?items using LazyColumn?items, not item, itemsList, or list.it and displays it with Text(it).val names = listOf("Anna", "Bob", "Cara")
LazyColumn {
items(names) { name ->
Text(text = name)
}
}val numbers = listOf(1, 2, 3)
LazyColumn {
items(numbers) { number ->
Text(number)
}
}number is an Int, causing a type mismatch.Text(number.toString()) to convert the number to a String before displaying.item { Text("Users") } to add a single header before the list.items(userList) { user -> Text(user) } to display each user below the header.Pass the test and this pattern moves unknown