//When you open a page, the adaptive screenWv_showweb_webactivity.getsettings (). Setusewideviewport (true);//set this property to scale any scaleWv_showweb_webactivity.getsettings (). Setloadwithoverviewmode (true); //Set WebView Hide Zoom control buttonWv_showweb_webactivity.getsettings (). Setdisplayzoomcontrols (false); //setting WebView support gesture ScalingWv_showweb_webactivity.getsettings (). Setbuiltinzoomcontrols (true); //WebView Loading Web ResourcesWv_showweb_webactivity.loadurl (bundle.getstring ("Job_url")); //Enable JavaScript supportWv_showweb_webactivity.getsettings (). setjavascriptenabled (true); //set priority to use cachewv_showweb_webactivity.getsettings (). Setcachemode (Websettings.load_cache_else_network); //Overwrite WebView default use of third-party or system default browser to open Web page behavior, so that the Web page opened with WebViewWv_showweb_webactivity.setwebviewclient (Newwebviewclient () {@Override Public Booleanshouldoverrideurlloading (WebView view, String URL) {//The return value is true when the control goes to WebView open, and the system browser or third-party browser is called falseview.loadurl (URL); return true; } }); //determine the page loading processWv_showweb_webactivity.setwebchromeclient (Newwebchromeclient () {@Override Public voidOnprogresschanged (WebView view,intnewprogress) {pb_showpro_webactivity.setvisibility (view.visible); if(newprogress = = 100) {pb_showpro_webactivity.setprogress (newprogress); Pb_showpro_webactivity.setvisibility (View.gone); }Else{pb_showpro_webactivity.setprogress (newprogress); } } });
2, listen to the physical keys, so that WebView can return to the history page
@Override public boolean OnKeyDown ( KeyCode, KeyEvent event) { if (keycode == keyevent . Keycode_back) { if (Wv_showweb_webacti Vity.cangoback ()) {wv_showweb_webactivity.goback (); return true ; else {finish (); }} return super .onkeydown (KeyCode, event); }
Some of the configuration items of Android--webview