Hello, everyone :slightly_smiling_face: What's the...
# compose
h
Hello, everyone 🙂 What's the best way to implement a nested scroll screen on Compose? My hierarchy is:
Copy code
MyScreen:
    Column():
        Text("Nice Title")
        LazyVerticalGrid:
            items(n) { MyItem() }
2
t
Maybe you could specify you question a little bit more in detail. Just guessing what you want: Write
Copy code
MyScreen:
    Column():
        Text("Nice Title")
        LazyVerticalGrid(modifier = Modifier.weight(1f)):
            items(n) { MyItem() }
This will give the Grid the rest of available space on the screen inside of the Column.
If you want that the text also scrolls i think this is currently not really possible with this LazyVerticalGrid Maybe better usind LazyColumn and than creating the grid on your own.
h
Actually, I wanted to achieve the following behavior:
And I did it using a header item
👍 1
But I was wondering if there was a better way
t
Nested scrolling can be used if you want e.g. that the header appears when you scroll up a little bit. Than you could put the header outside of the LazyGrid and do some nested scroll logic to handle scroll events that happen inside of the LazyGrid.
👍 1
h
I tried to read about this nestedscroll docs before, but I found too much boilerplate compared with my screenshot above resulting the same behavior
But I'll give it a try