WebView

WebView wv=FindViewById<WebView>(Resource.Id.WebView1);

wv.Settings.SetAppCacheEnabled(ture);

wv.Settings.JavaScriptEnabled=true;

wv.Settings.CacheMode=CacheModes.Default;

wv.LoadUrl("http://www.baidu.com");

wv.SetWebViewClient(new MyWebViewClient());

 override bool OnKeyDown(GeneratedEnum] Keycode keyCode)

{

if(keyCode==Keycode.Back && wv.CanGoBack())

{

wv.GoBack();

}

return base.OnKeyDown(keyCode,e);

}

public class MyWebViewClient:WebViewClient

{

       override bool ShouldOverrideUrlLoading(WebView view,string url)

{

view.LoadUrl(url);return true;

}

}

posted @ 2016-05-15 11:48  jeffery1010  Views(142)  Comments(0Edit  收藏  举报