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

farmerbb

06/09/2022, 10:02 PM
Is there any way to obtain the scroll position in pixels for a LazyListState?
🚫 1
a

Adam Powell

06/10/2022, 1:48 PM
No, not an absolute position from the beginning of the data set. Obtaining such a thing would require composing and measuring items for the full data set from the beginning, defeating the point of using a lazy container
f

farmerbb

06/10/2022, 3:11 PM
Makes sense, thanks!
Was able to get a solution working for this using
firstVisibleItemIndex
,
firstVisibleItemScrollOffset
, and keeping track of the
LayoutCoordinates
of each item in a map using
onGloballyPositioned
. It's not elegant but it works. Thanks @Francesc for the suggestion
8 Views