0

i have a RecyclerView with top padding and android:clipToPadding="false"

when findFirstCompletelyVisibleItemPosition() is called on the RecyclerView's LinearLayoutManager, it returns the index of the first item that would be completely visible if android:clipToPadding were set to true.

Any idea how to get the first actually completely visible item index if android:clipToPadding is set to false?

ADM
  • 20,406
  • 11
  • 52
  • 83
shmibbles
  • 398
  • 1
  • 3
  • 12

1 Answers1

0

i couldn't get it to work with LinearLayoutManager#findFirstCompletelyVisibleItemPosition(), but i figured out another solution.

Since I just needed to know how much the RecyclerView's top was offset, i used RecyclerView#computeVerticalScrollOffset(). Even though computeVerticalScrollOffset() estimates how much scrollable space is left, since i just needed to know how much was offset close to the top, it's good enough

shmibbles
  • 398
  • 1
  • 3
  • 12