Arpit Shukla
11/23/2021, 4:16 AMdata class Category (
val title: String,
val items: List<String>
)
And I want to display a list of Category
using a LazyColumn. I tried this:
LazyColumn {
items(list) { category ->
Text(text = category.title)
category.items.forEach { item ->
Text(text = item)
}
}
}
But I want to replace the inner loop with something lazy. I can't nest another LazyColumn. Using this@LazyColumn.items(category.items)
doesn't give the desired UI. How to implement this case?Albert Chang
11/23/2021, 4:19 AMLazyColumn {
list.forEach { category ->
item {
Text(text = category.title)
}
items(category.items) { item ->
Text(text = item)
}
}
}
Arpit Shukla
11/23/2021, 4:22 AM