In the Android Developers gesture design section, the term "swipe" is used.
In the developer section, the term "fling" is used.
Are these terms synonymous? From what I have found, I believe they are, but nowhere is it explicitly said one way or the other.
That said, if I want to implement functionality for a "swipe," should I implement onFling
in GestureDetector
?
Swipe gesture activities vary based on context. The speed at which a gesture is performed is the primary distinction between Drag, Swipe, and Fling.
Gesture velocity impacts whether the action is immediately reversible.
from https://www.google.com/design/spec/patterns/gestures.html
onFling()
will get executed when a user makes a "fling" motion, and said motion has a velocity with it to determine the type of fling it was. However, if a user simply touches the device and moves slowly across the screen, that would not be considered a fling, but a swipe.
It comes down to what type of motion you expect the users to perform. The ideal case would be to implement the onFling()
function to capture that motion, and also implement onDrag()
and onDragFinished()
to capture the more subtle motions that should still be considered a swipe.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With