The equivalent component to RecyclerView
or ListView
in Jetpack Compose is LazyColumn
for a vertical list and LazyRow
for a horizontal list. These compose and lay out only the currently visible items.
You can use it by formatting your data as a list and passing it with a @Composable
callback that emits the UI for a given item in the list. For example:
val myData = listOf("Hello,", "world!")
LazyColumn {
items(myData) { item ->
Text(text = item)
}
}
val myData = listOf("Hello,", "world!")
LazyRow {
items(myData) { item ->
Text(text = item)
}
}
You can also specify individual items one at a time:
LazyColumn {
item {
Text("Hello,")
}
item {
Text("world!")
}
}
LazyRow {
item {
Text("Hello,")
}
item {
Text("world!")
}
}
There are also indexed variants, which provide the index in the collection in addition to the item itself:
val myData = listOf("Hello,", "world!")
LazyColumn {
itemsIndexed(myData) { index, item ->
Text(text = "Item #$index is $item")
}
}
val myData = listOf("Hello,", "world!")
LazyRow {
itemsIndexed(myData) { index, item ->
Text(text = "Item #$index is $item")
}
}
These APIs were, in previous releases, known as AdapterList
, LazyColumnItems
/LazyRowItems
, and LazyColumnFor
/LazyRowFor
.
This is possible:
- Add a filter on the appropriate field (term reference to Fruits in
your example).
In the Configure filter criterion dialog:
- Set 'Filter type to expose' to 'Grouped filters'.
- Check "Allow multiple selections"
- Set 'Widget Type' to Radios.
- You probably want to empty 'Label'.
- Remove all but one of the filter sets in the table below.
In that remaining filter set:
- Fill in the label ('Citrus fruits' in your example).
- Set 'Operator ' to 'Is one of'.
- Under Value select the values you want to filter on (Oranges and Lemons in your example).
This gives you 1 checkbox, labeled 'Citrus Fruits'. So the UI is there. Unfortunately, issue [#2224601] prevents that it works, as it results in an invalid query, but a working patch is available.
Best Answer
You have to expose the The taxonomy term ID not the The taxonomy term name in order to get the little gear icon so that you can get the drop-down.