Take the 2-minute tour ×

How can I detect the end of a fling event within a HorizontalScrollView?

Using a GestureDetector, I can determine when onFling has started, but I can't figure out how to tell when it has completed. Is there any callback function or similar trick that I'm missing?

share|improve this question

2 Answers 2

up vote 3 down vote accepted

This answer is late but probably useful with the similar requirements

My approach is to override scrollTo of the View. With I reschedule a delayed message using a Handler. The effect is that as long as scroll call happens the message will not be delivered. But when no scroll call happens the message will be delivered and could be used to signal the end of "flinging"

Did you get the idea?

share|improve this answer
Thanks for writing after so long! I worked around the issue long ago, but this is an interesting solution. Unfortunately, I don't have time to test it right now, but I'll mark it as the answer since it seems like the "cleanest" solution. I'll keep this in mind if I need to do something like this again someday. Thanks again! –  PhilaPhan80 Mar 12 '12 at 1:18
I think it is better to override View.onScrollChanged: it is called in response to scrollTo and scrollBy. –  brillenheini Aug 9 '13 at 15:37

Probably by detecting an over scroll

How about this :

Use a combination of onFling() and onScrollChanged(). When an fling event occurs AND a scrolling event follows, you will get the exact amount of change.

share|improve this answer
That might work if the fling sent the view beyond its boundaries (overscroll), but there may be cases where it's a really long view and the fling stays within those boundaries. I'm looking more for an event that's triggered or a flag that's set, etc. –  PhilaPhan80 Nov 5 '11 at 15:48
In addition, OnOverScroll() API is not available on older API levels such as 8, etc. –  harikris Nov 14 '11 at 7:03
From what i see, onFling() gets triggered after a series of onScroll() when i fling the HorizontalScrollView –  harikris Nov 14 '11 at 18:59

Your Answer


