Some of the configuration items of Android--webview

Source: Internet
Author: User

 //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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.