java.lang.Object | |
↳ | android.view.ScaleGestureDetector |
Detects scaling transformation gestures using the supplied MotionEvent
s.
The ScaleGestureDetector.OnScaleGestureListener
callback will notify users when a particular
gesture event has occurred.
This class should only be used with MotionEvent
s reported via touch.
To use this class:
ScaleGestureDetector
for your
View
onTouchEvent(MotionEvent)
method ensure you call
onTouchEvent(MotionEvent)
. The methods defined in your
callback will be executed when the events occur.
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
ScaleGestureDetector.OnScaleGestureListener | The listener for receiving notifications when gestures occur. | ||||||||||
ScaleGestureDetector.SimpleOnScaleGestureListener | A convenience class to extend when you only want to listen for a subset of scaling-related events. |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Creates a ScaleGestureDetector with the supplied listener.
| |||||||||||
Creates a ScaleGestureDetector with the supplied listener.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Return the average distance between each of the pointers forming the
gesture in progress through the focal point.
| |||||||||||
Return the average X distance between each of the pointers forming the
gesture in progress through the focal point.
| |||||||||||
Return the average Y distance between each of the pointers forming the
gesture in progress through the focal point.
| |||||||||||
Return the event time of the current event being processed.
| |||||||||||
Get the X coordinate of the current gesture's focal point.
| |||||||||||
Get the Y coordinate of the current gesture's focal point.
| |||||||||||
Return the previous average distance between each of the pointers forming the
gesture in progress through the focal point.
| |||||||||||
Return the previous average X distance between each of the pointers forming the
gesture in progress through the focal point.
| |||||||||||
Return the previous average Y distance between each of the pointers forming the
gesture in progress through the focal point.
| |||||||||||
Return the scaling factor from the previous scale event to the current
event.
| |||||||||||
Return the time difference in milliseconds between the previous
accepted scaling event and the current scaling event.
| |||||||||||
Returns
true if a scale gesture is in progress. | |||||||||||
Return whether the quick scale gesture, in which the user performs a double tap followed by a
swipe, should perform scaling.
| |||||||||||
Accepts MotionEvents and dispatches events to a
ScaleGestureDetector.OnScaleGestureListener
when appropriate. | |||||||||||
Set whether the associated
ScaleGestureDetector.OnScaleGestureListener should receive onScale callbacks
when the user performs a doubleTap followed by a swipe. |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Creates a ScaleGestureDetector with the supplied listener.
You may only use this constructor from a Looper
thread.
context | the application's context |
---|---|
listener | the listener invoked for all the callbacks, this must not be null. |
NullPointerException | if listener is null.
|
---|
Creates a ScaleGestureDetector with the supplied listener.
context | the application's context |
---|---|
listener | the listener invoked for all the callbacks, this must not be null. |
handler | the handler to use for running deferred listener events. |
NullPointerException | if listener is null.
|
---|
Return the average distance between each of the pointers forming the gesture in progress through the focal point.
Return the average X distance between each of the pointers forming the gesture in progress through the focal point.
Return the average Y distance between each of the pointers forming the gesture in progress through the focal point.
Return the event time of the current event being processed.
Get the X coordinate of the current gesture's focal point.
If a gesture is in progress, the focal point is between
each of the pointers forming the gesture.
If isInProgress()
would return false, the result of this
function is undefined.
Get the Y coordinate of the current gesture's focal point.
If a gesture is in progress, the focal point is between
each of the pointers forming the gesture.
If isInProgress()
would return false, the result of this
function is undefined.
Return the previous average distance between each of the pointers forming the gesture in progress through the focal point.
Return the previous average X distance between each of the pointers forming the gesture in progress through the focal point.
Return the previous average Y distance between each of the pointers forming the gesture in progress through the focal point.
Return the scaling factor from the previous scale event to the current
event. This value is defined as
(getCurrentSpan()
/ getPreviousSpan()
).
Return the time difference in milliseconds between the previous accepted scaling event and the current scaling event.
Return whether the quick scale gesture, in which the user performs a double tap followed by a swipe, should perform scaling. .
Accepts MotionEvents and dispatches events to a ScaleGestureDetector.OnScaleGestureListener
when appropriate.
Applications should pass a complete and consistent event stream to this method. A complete and consistent event stream involves all MotionEvents from the initial ACTION_DOWN to the final ACTION_UP or ACTION_CANCEL.
event | The event to process |
---|
Set whether the associated ScaleGestureDetector.OnScaleGestureListener
should receive onScale callbacks
when the user performs a doubleTap followed by a swipe. Note that this is enabled by default
if the app targets API 19 and newer.
scales | true to enable quick scaling, false to disable |
---|