Is it possible to get scroll offset in pixels for ...
# compose
j
Is it possible to get scroll offset in pixels for
LazyColumn
? Can only see
firstVisibleItemScrollOffset
which is relative to items in the list
a
The point of lazy lists is that they lay out items lazily so that only items currently visible are laid out, which means heights of invisible items are unknown.
1
j
How could I achieve a fading background as the user scrolls down a list?
a
What do you mean by fading background?
j
I mean adjust the alpha of a background colour gradually as the user scrolls down a list
a
Use item index then. I don’t think laying out all items is worth as it is much less performant.
j
That only works if all the items are the same size
a
I know you can’t make the fade completely linear by using index, but as I said,
I don’t think laying out all items is worth as it is much less performant.
If you really want to try, just use a scrollable column and see how much it is slower than
LazyColumn
.
j
I don’t understand why losing virtualization is a requirement for tracking scroll offset? We had this functionality previously in our react native app which caches item heights as you scroll past them
a
What do you mean by virtualization? If you just want to know the heights of items you scrolled past, you can do the same thing.
j
Yeah it was more a question if theres anything out the box
a
I think no.
a
yes, it is expected to solve use cases like this with the nested scroll apis. but we don’t have good official examples yet as far as I remember
732 Views