Stay organized with collections
Save and categorize content based on your preferences.
ScaleGestureDetector.OnScaleGestureListener
public
static
interface
ScaleGestureDetector.OnScaleGestureListener
android.view.ScaleGestureDetector.OnScaleGestureListener
|
Known indirect subclasses
|
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:
Summary
Public methods
onScale
public abstract boolean onScale (ScaleGestureDetector detector)
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 . |
Returns |
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
public abstract boolean onScaleBegin (ScaleGestureDetector detector)
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 . |
Returns |
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
public abstract void onScaleEnd (ScaleGestureDetector detector)
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 . |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[null,null,["Last updated 2025-02-10 UTC."],[],[],null,["# ScaleGestureDetector.OnScaleGestureListener\n\nAdded in [API level 8](/guide/topics/manifest/uses-sdk-element#ApiLevels) \nSummary: [Methods](#pubmethods) \n\nScaleGestureDetector.OnScaleGestureListener\n===========================================\n\n*** ** * ** ***\n\n[Kotlin](/reference/kotlin/android/view/ScaleGestureDetector.OnScaleGestureListener \"View this page in Kotlin\") \\|Java\n\n\n`\npublic\nstatic\n\n\ninterface\nScaleGestureDetector.OnScaleGestureListener\n`\n\n\n`\n\n\n`\n\n|----------------------------------------------------------|\n| android.view.ScaleGestureDetector.OnScaleGestureListener |\n\n|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Known indirect subclasses [ScaleGestureDetector.SimpleOnScaleGestureListener](/reference/android/view/ScaleGestureDetector.SimpleOnScaleGestureListener) |--------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------| | [ScaleGestureDetector.SimpleOnScaleGestureListener](/reference/android/view/ScaleGestureDetector.SimpleOnScaleGestureListener) | A convenience class to extend when you only want to listen for a subset of scaling-related events. | |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nThe listener for receiving notifications when gestures occur.\nIf you want to listen for all the different gestures then implement\nthis interface. If you only want to listen for a subset it might\nbe easier to extend [SimpleOnScaleGestureListener](/reference/android/view/ScaleGestureDetector.SimpleOnScaleGestureListener).\n\nAn application will receive events in the following order:\n\n- One [OnScaleGestureListener.onScaleBegin(ScaleGestureDetector)](/reference/android/view/ScaleGestureDetector.OnScaleGestureListener#onScaleBegin(android.view.ScaleGestureDetector))\n- Zero or more [OnScaleGestureListener.onScale(ScaleGestureDetector)](/reference/android/view/ScaleGestureDetector.OnScaleGestureListener#onScale(android.view.ScaleGestureDetector))\n- One [OnScaleGestureListener.onScaleEnd(ScaleGestureDetector)](/reference/android/view/ScaleGestureDetector.OnScaleGestureListener#onScaleEnd(android.view.ScaleGestureDetector))\n\n\u003cbr /\u003e\n\nSummary\n-------\n\n| ### Public methods ||\n|---------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` abstract boolean` | ` `[onScale](/reference/android/view/ScaleGestureDetector.OnScaleGestureListener#onScale(android.view.ScaleGestureDetector))`(`[ScaleGestureDetector](/reference/android/view/ScaleGestureDetector)` detector) ` Responds to scaling events for a gesture in progress. |\n| ` abstract boolean` | ` `[onScaleBegin](/reference/android/view/ScaleGestureDetector.OnScaleGestureListener#onScaleBegin(android.view.ScaleGestureDetector))`(`[ScaleGestureDetector](/reference/android/view/ScaleGestureDetector)` detector) ` Responds to the beginning of a scaling gesture. |\n| ` abstract void` | ` `[onScaleEnd](/reference/android/view/ScaleGestureDetector.OnScaleGestureListener#onScaleEnd(android.view.ScaleGestureDetector))`(`[ScaleGestureDetector](/reference/android/view/ScaleGestureDetector)` detector) ` Responds to the end of a scale gesture. |\n\nPublic methods\n--------------\n\n### onScale\n\nAdded in [API level 8](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic abstract boolean onScale (ScaleGestureDetector detector)\n```\n\nResponds to scaling events for a gesture in progress.\nReported by pointer motion.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|------------|------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `detector` | `ScaleGestureDetector`: The detector reporting the event - use this to retrieve extended info about event state. This value cannot be `null`. \u003cbr /\u003e |\n\n| Returns ||\n|-----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `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. \u003cbr /\u003e |\n\n### onScaleBegin\n\nAdded in [API level 8](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic abstract boolean onScaleBegin (ScaleGestureDetector detector)\n```\n\nResponds to the beginning of a scaling gesture. Reported by\nnew pointers going down.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|------------|------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `detector` | `ScaleGestureDetector`: The detector reporting the event - use this to retrieve extended info about event state. This value cannot be `null`. \u003cbr /\u003e |\n\n| Returns ||\n|-----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `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. \u003cbr /\u003e |\n\n### onScaleEnd\n\nAdded in [API level 8](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic abstract void onScaleEnd (ScaleGestureDetector detector)\n```\n\nResponds to the end of a scale gesture. Reported by existing\npointers going up.\n\nOnce a scale has ended, [ScaleGestureDetector.getFocusX()](/reference/android/view/ScaleGestureDetector#getFocusX())\nand [ScaleGestureDetector.getFocusY()](/reference/android/view/ScaleGestureDetector#getFocusY()) will return focal point\nof the pointers remaining on the screen.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|------------|------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `detector` | `ScaleGestureDetector`: The detector reporting the event - use this to retrieve extended info about event state. This value cannot be `null`. \u003cbr /\u003e |"]]