sunil jain sunil jain - 2 months ago 18
Android Question

SimpleOnGestureListener.OnScroll doesn't calling properly on fast scrolling

I need to change an image when the user swipes from left to right; that's why I have used

SimpleOnGestureListener
to detect a swipe event on an
ImageView
.

In this process, when I swipe an image slowly, the
onScroll()
method calls frequently and every thing is working fine but when I swipe this image fastly, the
onScroll()
method called hardly only two three times, please let me know what should I use to make the
onScroll()
method called according swipe's speed.

I am a new bee to Android, so your help will be appreciated.

Thanks.

Answer

I can think of other ways of achieving what you want

onFling() gives you the velocity of X and Y: if it's greater than 4000 it counts as a fast scroll, then you can animate the continuous image, its effect like fast swiping.

Comments