Android View Pager 抛出错误的方式

发布于 2024-12-13 18:23:20 字数 630 浏览 1 评论 0原文

我在 android view-pager(ACL 的 r4)中发现了一个有趣的错误。

当您在较旧或较慢的设备上滚动手指太快/超出屏幕边缘时,速度跟踪器将以错误的方式抛出视图寻呼机。

我可以在原始 Galaxy Tab、HTC Desire、Nexus One、San Francisco、HTC Hero 上重现。

打开 Google+、市场或其他具有相当实质性的视图寻呼机实现的东西。

如果您转到最左边的页面,请轻轻拉动手指 在屏幕的右边缘,您可以让视图寻呼机跳转 向右(与拖动方向相反的方向)

我需要进行更多调查,但这看起来速度跟踪器无法跟上较慢的设备。这当然可以使视图寻呼机在快速从左向右滚动时跳转。尝试在新市场(3.3+)上从一侧转到另一侧,看看恼人的结果!

关于通过扩展类进行修复的任何想法..我认为,当发生很多事情时,屏幕可能会提供奇怪的结果,并且可能会丢失一些 MotionEvents,因为我发现它几乎不可能在较新的设备上复制。 (Nexus S、三星 GSII、Sensation)。

编辑:此问题已从 ACL v6 开始解决

谢谢, 克里斯

I have found an interesting bug in the android view-pager (r4 of the ACL).

The velocity tracker will fling the view-pager the wrong way when scrolling your finger too fast/off the edge of the screen on older or slow devices.

I can reproduce on original Galaxy Tab, HTC Desire, Nexus One, San Francisco, HTC Hero.

Open up Google +, market, or something with a fairly substational view pager implementation.

If you go to far left page, then gently pull your finger
over the right edge of the screen you can get the view-pager to jump
to the right (the opposite way to the drag direction).

I need to investigate more but this looks like the velocity tracker can't keep up on slower devices. This can of course make the view pager jump around when quickly scrolling left to right. try on the new market (3.3+) to go from one side to the other and see the annoying results!

Any ideas on fixes by extending the class.. Im thinking that the screen may be providing odd results when alot is going on and maybe missing some MotionEvents, as I have found it nearly impossible to replicat on newer devices. (Nexus S, Samsung GSII, Sensation).

EDIT: This problem has been resolved as of ACL v6

Thanks,
Chris

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

何其悲哀 2024-12-20 18:23:20

我认为与 r4 一起发布的 ViewPager 版本存在一些类似的问题,但现已得到修复。下一个版本应该很快就会发布。除了即将推出的修复之外,我们可能会随着时间的推移完善这一行为。

如果您很好奇并且想要编辑支持库包中包含的源代码,我相信解决方法是在 onInterceptTouchEvent 期间从初始按下事件开始将 MotionEvents 传递到 VelocityTracker,而不是仅在 onTouchEvent 中发生拦截之后。这为 VelocityTracker 提供了更多可供使用的数据。或者,您可以尝试其他触发器。

I think the version of ViewPager that went out with r4 had some issues like this that have since been fixed. The next release should be coming soon. This is a behavior that we will likely refine over time in addition to the upcoming fixes.

If you're curious and would like to edit the source included with the support library package, I believe the fix was to start passing MotionEvents to the VelocityTracker during onInterceptTouchEvent from the initial down event rather than only after the intercept occurred in onTouchEvent. This gives the VelocityTracker more data to work with. Alternatively you could experiment with other triggers.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文