bgogetap / StickyHeaders

Easily add Sticky Headers to your RecyclerView
Apache License 2.0
521 stars 88 forks source link

Scrolling to position doesn't always work #61

Closed coreywaldon closed 6 years ago

coreywaldon commented 6 years ago

I believe this to be a limitation of the layout manager, but when I call "scrollToPosition" on the recycler with any value other than 0, it doesn't seem to want to go to the position.

bgogetap commented 6 years ago

I don't see how this library could interfere with that at all.

Remember, default LinearLayoutManager (and probably others) just scroll to get the item onto the screen, they do not scroll until the requested position is at the top. For that you'll need to extend the LayoutManager and set the smooth scroller inside the smoothScrollToPosition callback to a custom one. Search for TopSnappedSmoothScroller and you'll probably find a few examples.

scrollToPositionWithOffset might work for you as well.

bgogetap commented 6 years ago

Closing for now.

Let me know if you have any other information that might point to this being an issue with the library.