如何在精确的位置(在两个视图之间的某个位置)上滚动用户? [英] How to scroll the user at the exact position, which is somewhere between two views.?

查看:57
本文介绍了如何在精确的位置(在两个视图之间的某个位置)上滚动用户?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

实际上我现在在android中实现一个recyclerview,我面临一个问题,当我进行分页(滚动)时,我想将用户滚动到分页之前用户所在的确切位置,但是当我使用scrollto时会发生什么呢? ()方法,它会滚动到上方的某些像素,或者有时会滚动到某些像素,但不是在确切位置.

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.

我想问的是为了重组我的问题,是否有任何可能的方法可以用来检查用户在任何位置的像素下降了多少像素,因为例如,用户可以在10到11之间的某个位置,但我会将他滚动到10或11,但我想在10到11之间精确地滚动他,有人可以请我启发我,我正在努力尝试,但我无法弄清楚为此.

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.

先谢谢您

推荐答案

您的问题尚不清楚,但是请尝试掩盖,

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

您应该使用:

LinearLayoutManager.scrollToPositionWithOffset(int, int)

这会将您的视图滚动到特定位置.

This will scroll your view to the specific position.

这篇关于如何在精确的位置(在两个视图之间的某个位置)上滚动用户?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆