Solution in views 3 (which may work in views 2)
Set a relationship for the view to join the terms to the nodes (in views 3 this is 'Taxonomy term: Content with term')
Then in the options tick 'Require this relationship' (this excludes terms without any nodes)
This may produce duplicates, in views 3 you open up Query settings, and tick Distinct (this will omit duplicates)
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
.
Best Answer
The Views module has a
taxonomy_term
View which you can use. You need to edit the View so that under theArguments
->Taxonomy: Term ID (with depth)
-> change the depth so that you can grab as many levels of child objects as you want. If you want to exclude the parent item, you can do this by adding a filter to exclude the parent term.