I have a webview in Xamarin Forms app for render html content and privacy policy. I'am facing two issues, that are follows.
Note: In iOS everything is working fine, no issues.
Pleas see my droid render implementation.
public override bool DispatchTouchEvent(MotionEvent e)
{
RequestDisallowInterceptTouchEvent(true);
return base.OnTouchEvent(e);
}
protected override void OnElementChanged(ElementChangedEventArgs<WebView> e)
{
base.OnElementChanged(e);
if (null == e.OldElement)
{
var webView = Element as CustomWebView;
Control.SetBackgroundColor(Android.Graphics.Color.Transparent);
Control.Settings.AllowUniversalAccessFromFileURLs = true;
Control.Settings.BuiltInZoomControls = true;
Control.Settings.DisplayZoomControls = true;
Control.Settings.JavaScriptEnabled = true;
Control.Settings.DomStorageEnabled = true;
Control.Settings.EnableSmoothTransition();
Control.Settings.SetSupportMultipleWindows(true);
Control.SetWebViewClient(new ExtendedWebViewClient(webView));
Control.SetWebChromeClient(new MyWebChromeClient());
Control.LoadUrl(control.Uri);
}
}
I have tried different options but no luck. Any help will be really appreciated.
Please disable DispatchTouchEvent method.Just use webView.Settings.UseWideViewPort=true;
in your WebViewRenderer
.
You can use following code in your WebViewRenderer
var webView = (global::Android.Webkit.WebView)Control;
webView.Settings.UseWideViewPort=true;
If I have long button. if I add this attribute, here is running GIF.