How to capture the current "fling" velocity on a scroll view and then trigger a new fling animation that looks continuous to the previous one?

2.2k views Asked by At

What I'm trying to do is make a horizontal scroll view go circular. Specifically, when the scrolling hits an edge the child view at the opposite end is moved there. My problem is continuing the fling animation after that.

I'm trying to capture the fling velocity with a GestureDetector and then pass it over to a Scroller (I tried OverScroller as well). When the view moving happens I call "getCurrVelocity()" on the scroller and then pass it to "fling()" on the scroll view.

Problem: The result is not continuous. The "restored" fling is faster than it should.

Note: One thing that looks wrong is fling() on the scroll view takes an int while the velocities you get from the GestureDetector and the Scrollers are float.

0

There are 0 answers