java.lang.Object | |
↳ | android.support.v4.view.GestureDetectorCompat |
Detects various gestures and events using the supplied MotionEvent
s.
The GestureDetector.OnGestureListener
callback will notify users when a particular
motion event has occurred. This class should only be used with MotionEvent
s
reported via touch (don't use for trackball events).
This compatibility implementation of the framework's GestureDetector guarantees the newer focal point scrolling behavior from Jellybean MR1 on all platform versions.
To use this class:GestureDetectorCompat
for your View
onTouchEvent(MotionEvent)
method ensure you call
onTouchEvent(MotionEvent)
. The methods defined in your callback
will be executed when the events occur.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Creates a GestureDetectorCompat with the supplied listener.
| |||||||||||
Creates a GestureDetectorCompat with the supplied listener.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Analyzes the given motion event and if applicable triggers the
appropriate callbacks on the
GestureDetector.OnGestureListener supplied.
| |||||||||||
Set whether longpress is enabled, if this is enabled when a user
presses and holds down you get a longpress event and nothing further.
| |||||||||||
Sets the listener which will be called for double-tap and related
gestures.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Creates a GestureDetectorCompat with the supplied listener. As usual, you may only use this constructor from a UI thread.
context | the application's context |
---|---|
listener | the listener invoked for all the callbacks, this must not be null. |
Creates a GestureDetectorCompat with the supplied listener. As usual, you may only use this constructor from a UI thread.
context | the application's context |
---|---|
listener | the listener invoked for all the callbacks, this must not be null. |
handler | the handler that will be used for posting deferred messages |
Analyzes the given motion event and if applicable triggers the
appropriate callbacks on the GestureDetector.OnGestureListener
supplied.
event | The current motion event. |
---|
GestureDetector.OnGestureListener
consumed the event,
else false.
Set whether longpress is enabled, if this is enabled when a user presses and holds down you get a longpress event and nothing further. If it's disabled the user can press and hold down and then later moved their finger and you will get scroll events. By default longpress is enabled.
enabled | whether longpress should be enabled. |
---|
Sets the listener which will be called for double-tap and related gestures.
listener | the listener invoked for all the callbacks, or null to stop listening for double-tap gestures. |
---|