Search code examples
androidxamarinxamarin.androidzooming

Xamarin.Forms HybridWebView zoom (Android)


I created a WebViewPage class that inherits from HybridWebView Now I need to implement the zoom but I can not find the string that allows to do

code:

public class WebViewPage : HybridWebView
    {
           ...code
    }
     protected override void OnStart()
            {
                var webView = Container.GetInstance<WebViewPage>();
                webView.LoadFromContent("index.html");
    ...code
    }

how I enable pinch to zoom?


Solution

  • You will need to modify the source and set the appropriate WebKit zoom settings.

    re: setBuiltInZoomControls

    In the HybridWebViewRenderer.cs you need to turn on BuiltInZoomControls and turn the visual zoom controls (DisplayZoomControls) off (if not desired).

    webView.Settings.BuiltInZoomControls = true;
    webView.Settings.DisplayZoomControls = false;