Handling native touch events through the FocusView

Since our camera implementation is handling focus changes from touch events, we are required to receive these touch events from the native side. Xamarin.Forms does not have touch events that give (x, y) coordinates, so we have to do some more custom rendering on the FocusView. Let's start with the Android implementation this time, inside the Renderers folder, add a new folder called FocusView, and add a new file called FocusViewGestureDetector.cs, and implement the following:

public class FocusViewGestureDetector : GestureDetector.SimpleOnGestureListener { #region Events public event EventHandler<MotionEvent> Touch; #endregion #region Public Methods public override void OnLongPress(MotionEvent ...

Get Xamarin Blueprints 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.