https://kotlinlang.org logo
#compose
Title
# compose
k

KotlinLeaner

01/31/2023, 3:20 PM
Hi, I want to put items at bottom of
LazyColumn
. So what is the best recommended way of doing in
LazyColumn
. Some content I put in
item
or
itemIndexed
which is correctly, but unable to know how to stick in bottom of screen?
Copy code
LazyColumn(
            contentPadding = PaddingValues(
                horizontal = 16.dp, vertical = 16.dp)
            ),
            verticalArrangement = Arrangement.spacedBy(16.dp),
        ) {
            item { Header() }

            itemsIndexed(storedDevice) { index, item ->
                Label({ index }, item, { list.size })
            }
            
            item { 
                Button() // stick in bottom of screen 
                Button() // stick in bottom of screen 
            }
        }
KqtHs.png
a

Altynbek Nurtaza

01/31/2023, 3:33 PM
why would you want them inside the lazyColumn?
k

KotlinLeaner

01/31/2023, 3:35 PM
In my
itemsIndexed
there are so many item, that's why I used
LazyColumn
for better performance in my smaller devices. I don't have any preference to put item at bottom in LazyColumn.
a

Altynbek Nurtaza

01/31/2023, 3:37 PM
try
Copy code
Column {
    LazyColumn(
        modifier = Modifier.weight(1f),
        ...,
    ) { ... }
    Button()
    Button()
}
k

KotlinLeaner

01/31/2023, 3:38 PM
Sure, thanks
k

Kirill Grouchnikov

01/31/2023, 5:05 PM
Do not put a scrollable container inside another scrollable container
k

KotlinLeaner

01/31/2023, 5:06 PM
What will happen then, If I do that?
k

Kirill Grouchnikov

01/31/2023, 5:07 PM
In this example it might be ok if you use weights correctly so that the outer column is not scrollable
k

KotlinLeaner

01/31/2023, 5:07 PM
okk
Thanks for guidance
5 Views