Consider this composable nested layout:
• LazyColumn(#1)
◦ Box (should not be a header)
◦ LazyColumn (#2)
▪︎ LazyRow
▪︎ Box
Is there a way to scroll the LazyColumn #1 out of it’s bounds so that the LazyColumn #2 first item’s offset is positioned at (0dp, 40dp) from the screen’s top left origin?
In Android leanback I used to use the WindowAlignement for that but I am wondering how can the same result be achieved using compose.
Thanks
j
Jakub Syty
12/28/2022, 8:40 AM
What is the point of LazyColumn inside LazyColumn? Why not just emit all elements in the LazyColumn#1?
👍 1
i
Issa
12/28/2022, 8:54 AM
The box in LazyColum #2 may embed a grid. I can get rid of the nested lazy column and flatten more the structure but still if i just scroll the lazyColumn (parent) to the last position i wouldn’t have the last element topleft anschor aligned with the screens topleft one
j
Jakub Syty
12/28/2022, 8:59 AM
ok, i'm not really sure what are you trying to achieve. If you want to take a height of LazyColumn#1 in LazyColumn#2 there is a
fillParentMaxHeight()
modifier, which will make the LazyColumn#2 the same height as the LazyColumn#1. But i'm not sure if that is what you are asking for
i
Issa
12/28/2022, 9:02 AM
I already tried that but it wouldn’t align any child to the specific position i want unfortunately 😕
though I was able to have what I want using
Modifier.offset(…)
but on the child level. However this technique will not consider repositioning the other children of the parent LazyColumn
j
Jakub Syty
12/28/2022, 9:11 AM
yea, i think offset isn't really a good fit with LazyColumn ;/
i
Issa
12/28/2022, 9:40 AM
I think the way to go is define my own custom lazylayout. I will post an answer once done. Thanks @Jakub Syty