Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

Pinch-Zoom Scrollview Renderer for Android

$
0
0

I have been able to implement pinch-zoom on iOS (see code below). However, I have not been able to find a way to render the ScrollViewRenderer with the same results. I have found the Android touch walkthrough but I am somewhat confused about the activity parallel, and on which level I should be/can implement the gesture listener. Has anyone had success with this?

Thanks...


using System;
using Xamarin.Forms.Platform.iOS;
using System.ComponentModel;
using MonoTouch.UIKit;
using Xamarin.Forms;
using SalesAppForms;
using SalesAppForms.iOS;

[assembly: ExportRenderer (typeof (PinchScrollView), typeof (PinchScrollViewRenderer))]
namespace SalesAppForms.iOS
{
public class PinchScrollViewRenderer : ScrollViewRenderer
{
public PinchScrollViewRenderer ()
{
}

    protected override void OnElementChanged (VisualElementChangedEventArgs e)
    {
        base.OnElementChanged (e);

        if (e.OldElement == null) {
            this.MaximumZoomScale = 4f;
            this.MinimumZoomScale = 0.5f;
            this.ViewForZoomingInScrollView += (UIScrollView sv) => { return this.Subviews[0]; };
        }
    }


}

}


Viewing all articles
Browse latest Browse all 58056

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>