本文整理汇总了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;
}
示例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);
}
示例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;
}
示例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
}
示例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);
}
示例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));
}
示例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);
}
示例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);
}
示例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);
}
示例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/");
}
示例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));
}
示例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;
}
示例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 ();
}
}
示例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));
}
示例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/");
}