How can I place a component under a `LazyColumnIte...
# compose
f
How can I place a component under a
LazyColumnItems
? I have no problem placing one above it, e.g.
Copy code
Column {
            Text("top")
            LazyColumnItems(items = listOf("1","2","3")) {
                Text(it)
            }
        }
But if I try to place it below the
bottom
text doesn't appear.
Copy code
Column {
            LazyColumnItems(items = listOf("1","2","3")) {
                Text(it)
            }
            Text("bottom")
        }
(In my case I also want to attach
bottom
to the bottom of the column so I would add
fillMaxHeight().wrapContentHeight(Alignment.Bottom)
as well)
m
LazyColumnItems
and
LazyRowItems
are yet to support wrap content, now they always fill
😢 1
t
Do you really want this? Noramlly you use LazyColumnItems when you expect a large number of items (>5) and this will fill the complete screen and than the bottom text is not visible anyways. So maybe you want an other layout? Maybe set the height to Modifier.weight(1f) for the LazyColumnItems element?
Copy code
Column {
            LazyColumnItems(modifier = Modifier.weight(1f), items = listOf("1","2","3")) {
                Text(it)
            }
            Text("bottom")
        }
f
I want the LazyColumnItems to end at the bottom element
using Modifier.weight() made the list disappear 😢
t
With my suggestion it will look exactly like this. But when you have not enough items in the list to fill the view there will be a gap between the last element in list and the bottom element.
f
yes that is good
t
weight(1f)
f
let me try to do it exactly like you showed, sec
yes that seems to work, I need to figure out why it doesn't work in my app then
t
This weight(1f) is the same like in the legacy (LinearLayout). So it will fill the rest of available space with the list.
f
Nice it works well now, thank you!
👍 1