public class ScaleGestureDetector
extends java.lang.Object
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
View.onTouchEvent(MotionEvent)
method ensure you call
onTouchEvent(MotionEvent)
. The methods defined in your callback will be executed when
the events occur.
Modifier and Type | Class and Description |
---|---|
static interface |
ScaleGestureDetector.OnScaleGestureListener
The listener for receiving notifications when gestures occur.
|
static class |
ScaleGestureDetector.SimpleOnScaleGestureListener
A convenience class to extend when you only want to listen for a subset of scaling-related
events.
|
Constructor and Description |
---|
ScaleGestureDetector(android.content.Context context,
ScaleGestureDetector.OnScaleGestureListener listener) |
Modifier and Type | Method and Description |
---|---|
double |
getAngle() |
android.view.MotionEvent |
getEvent() |
long |
getEventTime()
Return the event time of the current event being processed.
|
float |
getFocusX()
Get the X coordinate of the current gesture's focal point.
|
float |
getFocusY()
Get the Y coordinate of the current gesture's focal point.
|
android.view.MotionEvent |
getPreviousEvent() |
float |
getScaleFactor()
Return the scaling factor from the previous scale event to the current event.
|
android.view.MotionEvent |
getStartEvent() |
long |
getTimeDelta()
Return the time difference in milliseconds between the previous accepted scaling event and
the current scaling event.
|
boolean |
isInProgress()
Returns
true if a two-finger scale gesture is in progress. |
boolean |
onTouchEvent(android.view.MotionEvent event) |
public ScaleGestureDetector(android.content.Context context, ScaleGestureDetector.OnScaleGestureListener listener)
public boolean onTouchEvent(android.view.MotionEvent event)
public double getAngle()
public boolean isInProgress()
true
if a two-finger scale gesture is in progress.true
if a scale gesture is in progress, false
otherwise.public float getFocusX()
isInProgress()
would return false, the result of this function is undefined.public float getFocusY()
isInProgress()
would return false, the result of this function is undefined.public float getScaleFactor()
getCurrentSpan()
/ getPreviousSpan()
).public long getTimeDelta()
public long getEventTime()
public android.view.MotionEvent getEvent()
public android.view.MotionEvent getStartEvent()
public android.view.MotionEvent getPreviousEvent()