1. If there is JavaScript on the page visited, the WebView must be set to support JavaScript.
Mwebview.getsettings (). Setjavascriptenabled (True);
2, if the link in the page, if you want to click on the link to continue in the current browser response, instead of the new Android system browser should link in the ring, you must overwrite the WebView Webviewclient object.
Mwebview.setwebviewclient (New Webviewclient () {public Boolean shouldoverrideurlloading (WebView view, String URL) { view.loadurl (URL); return true; Returns True, representing the event has been processed, the event flows to this termination }});
3, if do not do any processing, browse the Web page, click the System "back" button, the entire browser will call finish () and end itself, if you want to browse the page fallback instead of exiting the browser, you need to process and consume the back event in the current activity.
public boolean onKeyDown (int keycode, keyevent event) { if (keycode = = keyevent.keycode_back) && mwebview.ca Ngoback ()) { mwebview.goback (); return true; } Return Super.onkeydown (KeyCode, event); }
4. If the user is required to manually enter a user name, password, or other webview, the WebView must be set to support the get gesture focus.
Mwebview.requestfocusfromtouch ();
5. Rewrite the webchromeclient onprogresschanged method to update the progress bar.
Mwebview.setwebchromeclient (New Webchromeclient () { //Update window Progress @Override public void when WebView progress changes Onprogresschanged (WebView view, int newprogress) { //activity has a progress range of 0 to 10000, so multiply this LoadActivity.this.setProgress (newprogress *); });
6, make webview support click Download link to jump.
Mwebview.setdownloadlistener (New Downloadlistener () { @Override public void Ondownloadstart (String URL , string useragent, String contentdisposition, String mimetype, long ContentLength) { //TODO auto-generated Me Thod stub uri uri = uri.parse (URL); Intent Intent = new Intent (Intent.action_view, URI); StartActivity (intent); } });