OnScaleGestureListener
interface OnScaleGestureListener
android.view.ScaleGestureDetector.OnScaleGestureListener |
The listener for receiving notifications when gestures occur. If you want to listen for all the different gestures then implement this interface. If you only want to listen for a subset it might be easier to extend SimpleOnScaleGestureListener
. An application will receive events in the following order:
- One
OnScaleGestureListener.onScaleBegin(ScaleGestureDetector)
- Zero or more
OnScaleGestureListener.onScale(ScaleGestureDetector)
- One
OnScaleGestureListener.onScaleEnd(ScaleGestureDetector)
Summary
Public methods | |
---|---|
abstract Boolean |
onScale(detector: ScaleGestureDetector) Responds to scaling events for a gesture in progress. |
abstract Boolean |
onScaleBegin(detector: ScaleGestureDetector) Responds to the beginning of a scaling gesture. |
abstract Unit |
onScaleEnd(detector: ScaleGestureDetector) Responds to the end of a scale gesture. |
Public methods
onScale
abstract fun onScale(detector: ScaleGestureDetector): Boolean
Responds to scaling events for a gesture in progress. Reported by pointer motion.
Parameters | |
---|---|
detector |
ScaleGestureDetector: The detector reporting the event - use this to retrieve extended info about event state. This value cannot be null . |
Return | |
---|---|
Boolean |
Whether or not the detector should consider this event as handled. If an event was not handled, the detector will continue to accumulate movement until an event is handled. This can be useful if an application, for example, only wants to update scaling factors if the change is greater than 0.01. |
onScaleBegin
abstract fun onScaleBegin(detector: ScaleGestureDetector): Boolean
Responds to the beginning of a scaling gesture. Reported by new pointers going down.
Parameters | |
---|---|
detector |
ScaleGestureDetector: The detector reporting the event - use this to retrieve extended info about event state. This value cannot be null . |
Return | |
---|---|
Boolean |
Whether or not the detector should continue recognizing this gesture. For example, if a gesture is beginning with a focal point outside of a region where it makes sense, onScaleBegin() may return false to ignore the rest of the gesture. |
onScaleEnd
abstract fun onScaleEnd(detector: ScaleGestureDetector): Unit
Responds to the end of a scale gesture. Reported by existing pointers going up. Once a scale has ended, ScaleGestureDetector.getFocusX()
and ScaleGestureDetector.getFocusY()
will return focal point of the pointers remaining on the screen.
Parameters | |
---|---|
detector |
ScaleGestureDetector: The detector reporting the event - use this to retrieve extended info about event state. This value cannot be null . |