当前位置: 首页>>代码示例>>C#>>正文


C# WebView.SetWebChromeClient方法代码示例

本文整理汇总了C#中WebView.SetWebChromeClient方法的典型用法代码示例。如果您正苦于以下问题:C# WebView.SetWebChromeClient方法的具体用法?C# WebView.SetWebChromeClient怎么用?C# WebView.SetWebChromeClient使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WebView的用法示例。


在下文中一共展示了WebView.SetWebChromeClient方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnCreate

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.WebViewInterop);

            wv = FindViewById<WebView>(Resource.Id.Web);
            wv.Settings.JavaScriptEnabled = true;

            // wire up the c#-to-javascript button
            RunScriptButton = FindViewById<Button>(Resource.Id.RunScriptButton);
            RunScriptButton.Click += (s, e) => {
                wv.LoadUrl("javascript:RunAction();");
                wv.LoadUrl("javascript:SetContent('Yay for content from C#');");
            };

            wv.LoadUrl("file:///android_asset/Content/InteractivePages/Home.html");
            
            wv.SetWebViewClient(new MonkeyWebViewClient(this));
            wv.SetWebChromeClient(new MonkeyWebChromeClient());     // required for javascript:alert() handling

            // allow zooming/panning
            wv.Settings.BuiltInZoomControls = true;
            wv.Settings.SetSupportZoom(true);

            // we DON'T want the page zoomed-out, since it is phone-sized content
            wv.Settings.LoadWithOverviewMode = false;
            wv.Settings.UseWideViewPort = false;

            // scrollbar stuff
            wv.ScrollBarStyle = ScrollbarStyles.OutsideOverlay; // so there's no 'white line'
            wv.ScrollbarFadingEnabled = false;
        }
开发者ID:ARMoir,项目名称:mobile-samples,代码行数:33,代码来源:WebViewInteropScreen.cs

示例2: OnViewCreated

		public override void OnViewCreated (View view, Bundle savedInstanceState)
		{
			mWebView = (WebView)view.FindViewById (Resource.Id.web_view);
			// Here, we use #mWebChromeClient with implementation for handling PermissionRequests.
			mWebView.SetWebChromeClient (mWebChromeClient);
			ConfigureWebSettings (mWebView.Settings);
		}
开发者ID:GTmAster,项目名称:monodroid-samples,代码行数:7,代码来源:PermissionRequestFragment.cs

示例3: OnCreate

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            _messageHub = Mvx.Resolve<IMvxMessenger>();

            var url = Intent.GetStringExtra("cheesebaron.mvxplugins.azureaccesscontrol.droid.Url");

            Window.RequestFeature(WindowFeatures.Progress);

            _webView = new WebView(this)
            {
                VerticalScrollBarEnabled = true,
                HorizontalScrollBarEnabled = true,
                ScrollBarStyle = ScrollbarStyles.OutsideOverlay,
                ScrollbarFadingEnabled = true
            };

            _webView.Settings.JavaScriptEnabled = true;
            _webView.Settings.SetSupportZoom(true);
            _webView.Settings.BuiltInZoomControls = true;
            _webView.Settings.LoadWithOverviewMode = true; //Load 100% zoomed out
            
            var notify = new AccessControlJavascriptNotify();
            notify.GotSecurityTokenResponse += GotSecurityTokenResponse;

            _webView.AddJavascriptInterface(notify, "external");
            _webView.SetWebViewClient(new AuthWebViewClient());
            _webView.SetWebChromeClient(new AuthWebChromeClient(this));

            _webView.LoadUrl(url);

            AddContentView(_webView, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent));
        }
开发者ID:kstreet,项目名称:Cheesebaron.MvxPlugins,代码行数:34,代码来源:AccessControlWebAuthActivity.cs

示例4: OnCreate

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            var url = Intent.GetStringExtra("monodroid.watoolkit.library.login.url");

            System.Diagnostics.Debug.WriteLine(url);

            Window.RequestFeature(WindowFeatures.Progress);

            var webView = new WebView(this);

            webView.Settings.JavaScriptEnabled = true;
            webView.Settings.SetSupportZoom(true);
            webView.Settings.BuiltInZoomControls = true;
            webView.Settings.LoadWithOverviewMode = true; //Load 100% zoomed out
            webView.ScrollBarStyle = ScrollbarStyles.OutsideOverlay;
            webView.ScrollbarFadingEnabled = true;

            webView.VerticalScrollBarEnabled = true;
            webView.HorizontalScrollBarEnabled = true;

            var notify = new AccessControlJavascriptNotify();
            notify.GotSecurityTokenResponse += GotSecurityTokenResponse;

            webView.AddJavascriptInterface(notify, "external");
            webView.SetWebViewClient(new AuthWebViewClient());
            webView.SetWebChromeClient(new AuthWebChromeClient(this));
            
            webView.LoadUrl(url);

            AddContentView(webView, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FillParent, ViewGroup.LayoutParams.FillParent));
        }
开发者ID:Cheesebaron,项目名称:MonoDroid.WAToolkit,代码行数:33,代码来源:AccessControlWebAuthActivity.cs

示例5: OnCreate

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);
            //"a16fe3fa136e7b54b24664bb2a3c647e"
            ColorDrawable colorDrawable = new ColorDrawable (Color.ParseColor (Helpers.ColorHeader));
            ActionBar.SetBackgroundDrawable (colorDrawable);

            //fb = new FacebookClient ();
            appId = Intent.GetStringExtra ("AppId");
            extendedPermissions = Intent.GetStringExtra ("ExtendedPermissions");
            url = GetFacebookLoginUrl (appId, extendedPermissions);

            WebView webView = new WebView(this);
            webView.Settings.JavaScriptEnabled = true;
            webView.Settings.SetSupportZoom(true);
            webView.Settings.BuiltInZoomControls = true;
            webView.Settings.LoadWithOverviewMode = true; //Load 100% zoomed out
            webView.ScrollBarStyle = ScrollbarStyles.OutsideOverlay;
            webView.ScrollbarFadingEnabled = true;

            webView.VerticalScrollBarEnabled = true;
            webView.HorizontalScrollBarEnabled = true;

            webView.SetWebViewClient(new FBWebClient (this));
            webView.SetWebChromeClient(new FBWebChromeClient (this));

            AddContentView(webView, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FillParent, ViewGroup.LayoutParams.FillParent));

            webView.LoadUrl(url);
        }
开发者ID:jhondiaz,项目名称:Viewwin,代码行数:30,代码来源:FBWebViewAuthActivity.cs

示例6: OnCreate

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

            fb = new FacebookClient ();
            appId = Intent.GetStringExtra ("AppId");
            extendedPermissions = Intent.GetStringExtra ("ExtendedPermissions");
            url = GetFacebookLoginUrl (appId, extendedPermissions);

            WebView webView = new WebView(this);
            webView.Settings.JavaScriptEnabled = true;
            webView.Settings.SetSupportZoom(true);
            webView.Settings.BuiltInZoomControls = true;
            webView.Settings.LoadWithOverviewMode = true; //Load 100% zoomed out
            webView.ScrollBarStyle = ScrollbarStyles.OutsideOverlay;
            webView.ScrollbarFadingEnabled = true;

            webView.VerticalScrollBarEnabled = true;
            webView.HorizontalScrollBarEnabled = true;

            webView.SetWebViewClient(new FBWebClient (this));
            webView.SetWebChromeClient(new FBWebChromeClient (this));

            AddContentView(webView, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FillParent, ViewGroup.LayoutParams.FillParent));

            webView.LoadUrl(url);
        }
开发者ID:dmerrill6,项目名称:MidgardMessenger,代码行数:27,代码来源:FBWebAuthActivity.cs

示例7: OnViewModelSet

        protected override void OnViewModelSet()
        {
            Window.RequestFeature(WindowFeatures.Progress);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar.SetHomeButtonEnabled(true);
            SupportActionBar.SetBackgroundDrawable(Resources.GetDrawable(Resource.Color.s_main_green));
            SupportActionBar.SetLogo(Resource.Drawable.logo_white);

            base.OnViewModelSet();

            SetContentView(Resource.Layout.page_webview);

            
            var set = this.CreateBindingSet<GenericWebViewView, GenericWebViewViewModel>();
            set.Bind(SupportActionBar).For(v => v.Title).To(vm => vm.Title).Mode(MvxBindingMode.OneWay);
            set.Apply();


            _webView = FindViewById<WebView>(Resource.Id.webView);
            _webView.Settings.JavaScriptEnabled = true;
            _webView.Settings.SetSupportZoom(true);


            var progressBar = FindViewById<ProgressBar>(Resource.Id.progressBar);
            var webChromeClient = new ProgressUpdatingWebChromeClient(progressBar);
            var webViewClient = new ProgressHandlingWebViewClient(progressBar);
            _webView.SetWebViewClient(webViewClient);
            _webView.SetWebChromeClient(webChromeClient);
    
            _webView.LoadUrl(ViewModel.Uri);
        }
开发者ID:khellang,项目名称:Solvberget,代码行数:31,代码来源:GenericWebViewView.cs

示例8: OnCreate

		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);
			// Set our view from the "main" layout resource
			SetContentView (Resource.Layout.Main);

			_pdfPath = _documentsPath + "/PDFView";
			_pdfFilePath  = Path.Combine(_pdfPath, _pdfFileName);

			// Check if the PDFDirectory Exists
			if(!Directory.Exists(_pdfPath)){
				Directory.CreateDirectory(_pdfPath);
			}
			else{
				// Check if the IDCard is there, If Yes Delete It. Because we will download the fresh one just in a moment
				if (File.Exists(_pdfFilePath)){
					File.Delete(_pdfFilePath);
				}
			}

			_webView = FindViewById<WebView> (Resource.Id.webView1);
			var settings = _webView.Settings;
			settings.JavaScriptEnabled = true;
			settings.AllowFileAccessFromFileURLs = true;
			settings.AllowUniversalAccessFromFileURLs = true;
			settings.BuiltInZoomControls = true;
			_webView.SetWebChromeClient(new WebChromeClient());
			_webView.LoadUrl("file:///android_asset/PDFViewer/index.html?file=" + _pdfFilePath);
		}
开发者ID:krikech,项目名称:Xamarin.PDFView,代码行数:29,代码来源:MainActivity.cs

示例9: OnCreateView

		public override View OnCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
		{
			
			ViewGroup root = (ViewGroup)inflater.Inflate (Resource.Layout.fragment_webview_with_spinner, null);

			// For some reason, if we omit this, NoSaveStateFrameLayout thinks we are
			// FILL_PARENT / WRAP_CONTENT, making the progress bar stick to the top of the activity.
			root.LayoutParameters = new ViewGroup.LayoutParams (ViewGroup.LayoutParams.FillParent, ViewGroup.LayoutParams.FillParent);
	
			loadingSpinner = root.FindViewById (Resource.Id.loading_spinner);
			webView = root.FindViewById<WebView> (Resource.Id.webview);
			webView.SetWebChromeClient (webChromeClient);
			webView.SetWebViewClient (webViewClient);
	
			webView.Post (() => {
				if (CLEAR_CACHE_ON_LOAD) {
					webView.ClearCache (true);	
				}
				webView.Settings.JavaScriptEnabled = true;
				webView.Settings.JavaScriptCanOpenWindowsAutomatically = false;
				webView.LoadUrl (MAP_URL);
				webView.AddJavascriptInterface (new MyMapJsi (Activity, savedInstanceState), MAP_JSI_NAME);
			});
			
			return root;
			
		}
开发者ID:BratislavDimitrov,项目名称:monodroid-samples,代码行数:27,代码来源:MapFragment.cs

示例10: HybridWebView

        public HybridWebView(WebView uiWebView)
        {
            _webView = uiWebView;

            _webView.SetWebViewClient(new HybridWebViewClient());
            _webView.Settings.CacheMode = CacheModes.CacheElseNetwork;
            _webView.Settings.JavaScriptEnabled = true;
            _webView.SetWebChromeClient(new HybridWebChromeClient(_webView.Context));
        }
开发者ID:CSharpCross,项目名称:HybridWithXamarin,代码行数:9,代码来源:HybridWebView.cs

示例11: GAEChannelClient

 /// <summary>
 /// Asynchronously open an AppEngine channel. </summary>
 public GAEChannelClient(Activity activity, string token, MessageHandler handler)
 {
     webView = new WebView(activity);
     webView.Settings.JavaScriptEnabled = true;
     webView.SetWebChromeClient(new WebChromeClientAnonymousInnerClassHelper(this)); // Purely for debugging.
     webView.SetWebViewClient(new WebViewClientAnonymousInnerClassHelper(this)); // Purely for debugging.
     Log.Debug(TAG,string.Format("token:{0}", token));
     _androidMessageHandler = new androidMessageHandler(activity, handler, token);
     webView.AddJavascriptInterface(_androidMessageHandler, "androidMessageHandler");
     webView.LoadUrl("file:///android_asset/channel.html");
 }
开发者ID:kenneththorman,项目名称:appspotdemo-mono,代码行数:13,代码来源:GAEChannelClient.cs

示例12: HybridWebView

        public HybridWebView(WebView uiWebView)
        {
            webView = uiWebView;

            // Use subclassed WebViewClient to intercept hybrid native calls
            var webViewClient = new HybridWebViewClient ();

            webView.SetWebViewClient (webViewClient);
            webView.Settings.CacheMode = CacheModes.CacheElseNetwork;
            webView.Settings.JavaScriptEnabled = true;
            webView.SetWebChromeClient (new HybridWebChromeClient (webView.Context));
        }
开发者ID:MilenPavlov,项目名称:PortableRazorStarterKit,代码行数:12,代码来源:HybridWebView.cs

示例13: OnCreateView

        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            View v = inflater.Inflate(Resource.Layout.webview, container, false);

            ProgressBar viewContentProgress = v.FindViewById<ProgressBar>(Resource.Id.progress);
            ViewContentWebView = v.FindViewById<WebView>(Resource.Id.webview);
            ViewContentWebView.Settings.JavaScriptEnabled = true;
            ViewContentWebView.SetWebViewClient(new MyWebViewClient(this));
            ViewContentWebView.SetWebChromeClient(new MyWebChromeClient(this, viewContentProgress));

            return v;
        }
开发者ID:GuyMicciche,项目名称:ActionsContentView,代码行数:12,代码来源:WebViewFragment.cs

示例14: OnCreate

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

#if __APPCOMPAT__
            ActionBar.SetDisplayHomeAsUpEnabled(true);
#elif __ANDROID_14__
            Window.RequestFeature(WindowFeatures.ActionBar | WindowFeatures.Progress);
            ActionBar.SetDisplayHomeAsUpEnabled(true);
#else
            Window.RequestFeature(WindowFeatures.Progress);
#endif

            _messageHub = Mvx.Resolve<IMvxMessenger>();

            var url = Intent.GetStringExtra("cheesebaron.mvxplugins.azureaccesscontrol.droid.Url");

            _webView = new WebView(this)
            {
                VerticalScrollBarEnabled = true,
                HorizontalScrollBarEnabled = true,
                ScrollbarFadingEnabled = false,
                ScrollBarStyle = ScrollbarStyles.OutsideOverlay
            };

            _webView.Settings.JavaScriptEnabled = true;
            _webView.Settings.SetSupportZoom(true);
            _webView.Settings.BuiltInZoomControls = true;
            _webView.Settings.LoadWithOverviewMode = true;
            _webView.Settings.UseWideViewPort = true;

            _notify = new external();
            _notify.GotSecurityTokenResponse += GotSecurityTokenResponse;

            _webView.AddJavascriptInterface(_notify, "external");
            _webView.SetWebViewClient(new AuthWebViewClient());
            _webView.SetWebChromeClient(new AuthWebChromeClient(this));

            _webView.LoadUrl(url);

            AddContentView(_webView, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent));
        }
开发者ID:Everbridge,项目名称:sm-Cheesebaron.MvxPlugins,代码行数:42,代码来源:AccessControlWebAuthActivity.cs

示例15: SetWebView

        private void SetWebView()
        {
            webView = new WebView(this);
            webView.Settings.JavaScriptEnabled = true;
            webView.Settings.SetSupportZoom(true);
            webView.Settings.BuiltInZoomControls = true;
            webView.Settings.LoadWithOverviewMode = true; //Load 100% zoomed out
            webView.ScrollBarStyle = ScrollbarStyles.OutsideOverlay;
            webView.ScrollbarFadingEnabled = true;

            webView.VerticalScrollBarEnabled = true;
            webView.HorizontalScrollBarEnabled = true;

            webView.SetWebViewClient(new FBWebClient(this));
            webView.SetWebChromeClient(new FBWebChromeClient(this));

            AddContentView(webView, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FillParent, ViewGroup.LayoutParams.FillParent));

            webView.LoadUrl((ViewModel as FacebookLoginViewModel).LoginUri.AbsoluteUri);
        }
开发者ID:jmmortega,项目名称:CadizDeveloperApp,代码行数:20,代码来源:FacebookLoginView.cs


注:本文中的WebView.SetWebChromeClient方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。