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


C# WebView.SetWebViewClient方法代码示例

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


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

示例1: 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

示例2: OnCreate

        protected override void OnCreate(Bundle bundle)
        {
            Console.WriteLine("AboutActivity - OnCreate");
            base.OnCreate(bundle);

            _navigationManager = Bootstrapper.GetContainer().Resolve<MobileNavigationManager>();
            SetContentView(Resource.Layout.About);
            ActionBar.SetDisplayHomeAsUpEnabled(true);
            ActionBar.SetHomeButtonEnabled(true);

            _progressBar = FindViewById<ProgressBar>(Resource.Id.about_progressBar);
            _lblLoading = FindViewById<TextView>(Resource.Id.about_lblLoading);
            _webView = FindViewById<WebView>(Resource.Id.about_webView);
            _webViewClient = new MyWebViewClient();
            _webViewClient.PageFinished += (sender, args) => {
                Animation anim = AnimationUtils.LoadAnimation(this, Resource.Animation.fade_out);
                anim.AnimationEnd += (animSender, animArgs) => {
                    _lblLoading.Visibility = ViewStates.Gone;
                };
                _lblLoading.StartAnimation(anim);

                Animation anim2 = AnimationUtils.LoadAnimation(this, Resource.Animation.fade_out);
                anim2.AnimationEnd += (animSender, animArgs) => {
                    _progressBar.Visibility = ViewStates.Gone;
                };
                _progressBar.StartAnimation(anim2);
            };
            _webView.SetWebViewClient(_webViewClient);

            // Since the onViewReady action could not be added to an intent, tell the NavMgr the view is ready
            //((AndroidNavigationManager)_navigationManager).SetAboutActivityInstance(this);
            _navigationManager.BindAboutView(this);
        }
开发者ID:pascalfr,项目名称:MPfm,代码行数:33,代码来源:AboutActivity.cs

示例3: 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

示例4: OnCreate

        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate (savedInstanceState);
            if (!((GlobalvarsApp)this.Application).ISLOGON) {
                Finish ();
            }
            SetTitle (Resource.String.SHOWLOCATION);
            SetContentView (Resource.Layout.ShowLocation);
            pathToDatabase = ((GlobalvarsApp)this.Application).DATABASE_PATH;
            latlng= Intent.GetStringExtra ("location") ?? "";

            date =  DateTime.Today;
            wv1= FindViewById<WebView> (Resource.Id.webView1);
            btnBack =FindViewById<Button> (Resource.Id.butBack);
            btnShow =FindViewById<Button> (Resource.Id.butMaP);
            txtdate = FindViewById<EditText> (Resource.Id.date);
            wv1.SetWebViewClient (new myWebView ());

            imm = (InputMethodManager)GetSystemService(Context.InputMethodService);
            txtdate.Click += delegate(object sender, EventArgs e) {
                imm.HideSoftInputFromWindow(txtdate.WindowToken, 0);
                ShowDialog (DATE_DIALOG_ID1);
            };

            btnShow.Click+= (object sender, EventArgs e) => {
                ShowMap();
            };
            btnBack.Click+= (object sender, EventArgs e) => {
                base.OnBackPressed();
            };

            // Create your application here
        }
开发者ID:mokth,项目名称:merpV3,代码行数:33,代码来源:ShowMapActivity.cs

示例5: 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

示例6: 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

示例7: 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

示例8: onCreate

        /// <summary>
        /// Construct the UI and start loading
        /// </summary>
		public void onCreate()
		{
			string startUrl = webSettings.GetString ("url");
			string title = webSettings.GetString ("title");
			mainLayout = new LinearLayout (this.context);
			LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams (ViewGroup.LayoutParams.FillParent, ViewGroup.LayoutParams.FillParent, 0.0F);
			mainLayout.LayoutParameters = lp;
			((LinearLayout)mainLayout).SetGravity (GravityFlags.CenterVertical);
			((LinearLayout)mainLayout).Orientation = Orientation.Vertical;

			webView = new WebView (this.context);
			WebSettings settings = webView.Settings;
			settings.JavaScriptEnabled = true;
			settings.BuiltInZoomControls = true;
			settings.JavaScriptCanOpenWindowsAutomatically = true;

			webView.LayoutParameters = new LinearLayout.LayoutParams (ViewGroup.LayoutParams.FillParent, ViewGroup.LayoutParams.FillParent, 1.0F);

			webView.SetWebViewClient (new FHOAuthWebViewClient (this));
			webView.RequestFocusFromTouch ();
			webView.Visibility = ViewStates.Visible;

			LinearLayout barlayout = initHeaderBar (title);

			mainLayout.AddView (barlayout);
			mainLayout.SetBackgroundColor (Color.Transparent);
			mainLayout.SetBackgroundResource (0);
			mainLayout.AddView (this.webView);

			this.webView.LoadUrl (startUrl);

		}
开发者ID:secondsun,项目名称:fh-dotnet-sdk,代码行数:35,代码来源:FHOAuthWebview.cs

示例9: 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

示例10: OnCreate

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

            SetContentView(Resource.Layout.Main);

            var downloadButton = FindViewById<Button>(Resource.Id.downloadButton);
            FindViewById<Button>(Resource.Id.backButton).Click += (sender, args) => { if (_webView.CanGoBack()) _webView.GoBack(); };
            FindViewById<Button>(Resource.Id.forwardButton).Click += (sender, args) => { if (_webView.CanGoForward()) _webView.GoForward(); };
            _webView = FindViewById<WebView>(Resource.Id.webView1);
            var progressBar = FindViewById<ProgressBar>(Resource.Id.progressBar1);
            var title = FindViewById<TextView>(Resource.Id.textView1);
            var frame = FindViewById(Resource.Id.frameDownload);
            frame.Visibility = ViewStates.Gone;
            var viewControls = new ViewControls {
                DownloadButton = downloadButton,
                ProgressBar = progressBar,
                Title = title,
                DownloadFrame = frame,
                Activity = this
            };
            _webView.Settings.JavaScriptEnabled = true;
            _webView.SetWebViewClient(new YoutubeWebViewClient(viewControls));
            _webView.LoadUrl("http://www.youtube.com/");
        }
开发者ID:x011,项目名称:ms.video.downloader.android,代码行数:25,代码来源:Activity1.cs

示例11: 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

示例12: OnCreateView

		public override View OnCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
		{
			var root = 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);
			
			loading_spinner = root.FindViewById<View> (Resource.Id.loading_spinner);
			web_view = root.FindViewById<WebView> (Resource.Id.webview);

			web_view.SetWebViewClient (new TagWebViewClient (Activity));

			web_view.Post (() => {
				web_view.Settings.JavaScriptEnabled = true;
				web_view.Settings.JavaScriptCanOpenWindowsAutomatically = false;

				try {
					var url = "http://twitter.com/#!/search/{0}";
					url = string.Format (url, Uri.EscapeDataString (search_string));

					web_view.LoadUrl (url);
				} catch (UnsupportedEncodingException ex) {
					Log.Error ("MonoIO", "Could not construct the realtime search URL", ex);
				}
			});
			

			return root;
		}
开发者ID:BratislavDimitrov,项目名称:monodroid-samples,代码行数:30,代码来源:TagStreamFragment.cs

示例13: OnCreate

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

			//
			// Load the state either from a configuration change or from the intent.
			//
			state = LastNonConfigurationInstance as State;
			if (state == null && Intent.HasExtra ("StateKey")) {
				var stateKey = Intent.GetStringExtra ("StateKey");
				state = StateRepo.Remove (stateKey);
			}
			if (state == null) {
				Finish ();
				return;
			}

			Title = state.Authenticator.Title;

			//
			// Watch for completion
			//
			state.Authenticator.Completed += (s, e) => {
				SetResult (e.IsAuthenticated ? Result.Ok : Result.Canceled);
				Finish ();
			};
			state.Authenticator.Error += (s, e) => {
				if (e.Exception != null) {
					this.ShowError ("Authentication Error", e.Exception);
				}
				else {
					this.ShowError ("Authentication Error", e.Message);
				}
				BeginLoadingInitialUrl ();
			};

			//
			// Build the UI
			//
			webView = new WebView (this) {
				Id = 42,
			};
			webView.Settings.JavaScriptEnabled = true;
			webView.SetWebViewClient (new Client (this));
			SetContentView (webView);

			//
			// Restore the UI state or start over
			//
			if (savedInstanceState != null) {
				webView.RestoreState (savedInstanceState);
			}
			else {
				if (Intent.GetBooleanExtra ("ClearCookies", true))
					WebAuthenticator.ClearCookies();

				BeginLoadingInitialUrl ();
			}
		}
开发者ID:jhsfdc,项目名称:SalesforceSDK,代码行数:59,代码来源:WebAuthenticatorActivity.cs

示例14: 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

示例15: OnCreate

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

            SetContentView (Resource.Layout.WebViewTests);
            // Create your application here
            _webView = FindViewById<WebView>(Resource.Id.web_view);
            _webView.SetWebViewClient (new CustomClient ());
            _webView.LoadUrl ("http://espn.go.com/");
        }
开发者ID:acroos,项目名称:Xamarin.Android.Sample,代码行数:10,代码来源:WebViewTestActivity.cs


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