How to scroll the user at the exact position, which is somewhere between two views.?

走远了吗. 提交于 2019-12-09 19:10:24

问题


Actually i am implementing a recyclerview in android now i am facing a problem that when i do pagination(scrolling) then i want to scroll the user to the exact position where user was before pagination but what happens is that when i use scrollto() method it scroll to some pixels above or sometimes some pixels beow but not at the exact position.

As in order to restructure my problem i want to ask is, is there any possible way by which i can check how many pixel down was the user at any position, because for example user can be somewhere between the 10 and 11 but i will scroll him to 10 or 11 but i want to scroll him at exact between 10 and 11 where he was can anyone please enlighten me i am trying so hard but i am not able to figure it out how to do this.

Thank you in Advance.


回答1:


Your question is somehow not clear but try to cover it up,

You should use:

LinearLayoutManager.scrollToPositionWithOffset(int, int)

This will scroll your view to the specific position.



来源:https://stackoverflow.com/questions/32321952/how-to-scroll-the-user-at-the-exact-position-which-is-somewhere-between-two-vie

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!