Hello, does anyone know how can i slightly overlap the first two items of a list in compose?
The first item will actually be an image configured as collapsable and act as a toolbar, while the second one will be the "beginning of the view".
I know i can put two items in a box to overlap them, but since here they belong to a LazyColumn, i don't know how can i do it
m
MR3Y
09/15/2022, 6:18 PM
what about setting LazyColumn's
verticalArrangment
parameter to
Arrangement.spacedBy((-value).dp)
? replace
value
with whichever number and adjust that number until you get the exact overlapping ratio you want
j
Jorge DomÃnguez
09/15/2022, 7:11 PM
wouldn't that overlap all items in the
LazyColumn
? I'd rather use the
.offset()
modifier on the second item
m
MR3Y
09/15/2022, 7:14 PM
This might be a good solution too! actually, I've assumed that the lazy column contains only those two items (the image, and the view)
f
filipegoncalves
09/15/2022, 11:51 PM
Yes, that was my issue using the spacedBy solution, it would affect all of the items.
I will try the offset, thanks for the help guys ! 🙂
filipegoncalves
09/18/2022, 10:21 PM
Hello just for future reference for anyone reading this here, by shifting this view upwards (or downwards) it will affect the original spacing for the other elements on the list.
m
MR3Y
09/18/2022, 11:03 PM
I guess making a custom Arrangment.Vertical would exactly do the trick here for you, take a look at this approach and the