0

When I am trying to smooth scroll to top element, mostly it gets stuck to 2nd or 3rd item. I am trying below code :

 recyclerView.smoothScrollToPosition(0);

Can anyone help me solve this issue?

Sapna Sharma
  • 460
  • 7
  • 22

1 Answers1

4

So, after spending some hours I solved it myself. I don't know what's the logic behind this but setting

recyclerView.smoothScrollToPosition(-10);

works for me. Now it always takes me to top element along with smooth scrolling.

Sapna Sharma
  • 460
  • 7
  • 22