Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RecyclerView scrollToPosition makes header go to wrong place #49

Closed
mazoni opened this issue May 31, 2015 · 2 comments
Closed

RecyclerView scrollToPosition makes header go to wrong place #49

mazoni opened this issue May 31, 2015 · 2 comments

Comments

@mazoni
Copy link

mazoni commented May 31, 2015

Hi there, congrats for the library, it's really easy to use and works great.
I'm having a small issue: whenever I do a scrollToPosition on my recyclerview the sticky header don't refresh itself. In other words if I'm at the beginning of the recyclerview and execute a scrollToPosition to the last position of the recyclerview the whole header remains in screen, event the part that is not supposed to be sticky. I can attach some images if that is not clear enough. Can someone help me? Thanks in advance.

@mazoni
Copy link
Author

mazoni commented May 31, 2015

It probably has something to do with this: http://stackoverflow.com/questions/27819507/recyclerview-scrolltoposition-not-trigger-scrolllistener ... since the stickyheader counts with OnScrollListener to update the header position...

@mazoni
Copy link
Author

mazoni commented May 31, 2015

Guys, I've found a work around for this case. It's to use the smoothScrollToPosition within the layout manager. This seems to trigger the ScrollListener and the header works great then...

I used to have this:

recyclerView.scrollToPosition(recyclerAdapter.getItemCount() - 1);

and now I have this:

recyclerView.getLayoutManager().smoothScrollToPosition(recyclerView, null, recyclerAdapter.getItemCount() - 1);

I'll close this issue since it seems to be a bug in Android and not on this library. And this workaround works fine.

@mazoni mazoni closed this as completed May 31, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant