android - How to compute the verticalScrollRange() for LazyVerticalGrid in Jetpack Compose with different spans? - Stack Overflo

admin2025-04-17  2

I'm working with LazyVerticalGrid in Jetpack Compose where I have items with varying spans (e.g., some items take up 1 span, others take up 4 spans). I need to compute the verticalScrollRange() of the grid, but I'm unsure how to correctly account for the varying span sizes.

I understand that the scroll range should be calculated by considering the height of each item, but since the items have different span counts, I need a way to incorporate this into the scroll range calculation.

How can I compute the verticalScrollRange() correctly when the grid items have different span sizes? Is there a way to factor in the span count of each item in the grid to get an accurate scroll range?

转载请注明原文地址:http://anycun.com/QandA/1744825475a88141.html