O'Reilly logo

Xamarin Mobile Development for Android Cookbook by Matthew Leibowitz

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Detecting rotate gestures

A common gesture for manipulating objects on the screen is to use the twist or rotate gesture. This is often more natural than entering a rotation value or dragging a cursor.

How to do it...

Another multifinger gesture that is very common is the rotate gesture. For a two-finger rotate, we can do something very similar to what we would do when implementing the ScaleGestureDetector instance. However, we do have to create a RotateGestureDetector instance ourselves as this is not currently provided by the framework. We will create RotateGestureDetector by preforming the following steps:

  1. First, we need an interface that represents our gesture detector's events:
    public interface IOnRotateGestureListener { bool OnRotateBegin(RotateGestureDetector ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required