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

georgiy.shur

03/29/2022, 10:30 PM
In
LazyListScope
there is a
stickyHeader { }
function. I’d like to achieve the same behavior, but for sticky footer: the item should stick to the bottom until the user scrolls to it, and after the user scrolls further down, the item has to scroll normally together with the content. Is there some smart way to achieve this behavior?
c

Chris Sinco [G]

03/30/2022, 7:57 AM
What does that look like? Could you share a video or mock?
g

georgiy.shur

04/04/2022, 4:44 PM
@Chris Sinco [G] Sorry for the delayed response. I was able to achieve this behavior by setting
reverseLayout = true
to the
LazyColumn
and using a
stickyHeader
. But I actually don’t want to reverse the layout while keeping this “sticky footer” behavior.
c

Chris Sinco [G]

04/04/2022, 5:23 PM
Gotcha - @Andrey Kulikov any suggestions?
a

Andrey Kulikov

04/04/2022, 5:44 PM
Hey. There is no easy solution for it yet unfortunately. stickyHeaders are still experimental. Ideally we want to try to reimplement it on top of the public api so this is way more customizable. But no clear timeline on it yet
g

georgiy.shur

04/04/2022, 6:48 PM
Ok, thanks! Maybe there is at least some suggestion on how to mimic the same behavior without implementing a custom lazy list composable?
c

Chris Sinco [G]

04/04/2022, 7:28 PM
Considering you got it working with the reverseLayout, you could reverse the list itself that you pass, which should counter the order of your layout, and still give you the stickyHeader on the bottom?
g

georgiy.shur

04/04/2022, 7:57 PM
I thought there may be some issues with initial scrolling position etc., but thanks, I’ll give it a shot!
14 Views