protected override void OnElementChanged(ElementChangedEventArgs <TencentWebView> e) { mRelativeLayout = Inflate(Context, Resource.Layout.WebViewLayout, null) as Android.Widget.RelativeLayout; tencentWebView = mRelativeLayout.FindViewById <Com.Tencent.Smtt.Sdk.WebView>(Resource.Id.forum_context); tencentWebView.Settings.JavaScriptCanOpenWindowsAutomatically = true; //x变量非null表示启用x5内核成功 var x = tencentWebView.X5WebViewExtension; tencentWebView.SetMinimumWidth(100); tencentWebView.SetMinimumHeight(800); SetNativeControl(mRelativeLayout); //tencentWebView.LoadUrl("http://soft.imtt.qq.com/browser/tes/feedback.html"); tencentWebView.LoadUrl("https://www.qq.com"); //tencentWebView.LoadUrl("https://debugtbs.qq.com"); }
protected override void OnElementChanged(ElementChangedEventArgs <TencentWebView> e) { base.OnElementChanged(e); if (e.OldElement != null) { // Unsubscribe from event handlers and cleanup any resources } if (e.NewElement != null) { if (Control == null) { // Instantiate the native control and assign it to the Control property with // the SetNativeControl method mRelativeLayout = Inflate(Context, Resource.Layout.WebViewLayout, null) as Android.Widget.RelativeLayout; tencentWebView = mRelativeLayout.FindViewById <Com.Tencent.Smtt.Sdk.WebView>(Resource.Id.forum_context); tencentWebView.Settings.JavaScriptCanOpenWindowsAutomatically = true; //x变量非null表示启用x5内核成功 var x = tencentWebView.X5WebViewExtension; tencentWebView.SetMinimumWidth(100); tencentWebView.SetMinimumHeight(800); //tencentWebView.SetLayerType(); tencentWebView.Settings.UseWideViewPort = true; tencentWebView.Settings.LoadWithOverviewMode = true; tencentWebView.Settings.SetLayoutAlgorithm(WebSettings.LayoutAlgorithm.SingleColumn); tencentWebView.Settings.TextZoom = 100; tencentWebView.DrawingCacheEnabled = true; SetNativeControl(mRelativeLayout); tencentWebView.LoadUrl(e.NewElement.Url); } // Configure the control and subscribe to event handlers } }