Pinch-to-zoom with multi-touch gestures

The previous recipe used the SimpleOnGestureListener to provide detection of simple, one-finger, gestures. In this recipe, we will demonstrate multi-touch with the common pinch-to-zoom gesture using the SimpleOnScaleGestureListener class.

The following screenshot shows the icon zoomed out using the application created in the following recipe:

Pinch-to-zoom with multi-touch gestures

The following screenshot shows the icon zoomed in:

Pinch-to-zoom with multi-touch gestures

Getting ready

Create a new project in Android Studio and call it: MultiTouchZoom. Use the default Phone & Tablet options ...

Get Android Application Development Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.