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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.