質問

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

役に立ちましたか?

解決

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.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top