A section of Android jump to web interface code

Source: Internet
Author: User

The code is down from [email protected], due to a bit of the basis of downloading someone else's code in a way to brush up. @Overridepublic  void onclick (view v)  {if  (null != pop &&  Pop.isshowing ())  {//  Hide window, if set to click outside the window hours that do not need this way to hide Pop.dismiss ();}  else {//  Popup Popupwindow specific code layoutinflater inflater =  (layoutinflater)   Getsystemservice (Layout_inflater_service); View view = inflater.inflate (r.layout.popup, null);//  Create Popupwindow object pop =  New popupwindow (View, 500, 700, false);//  need to set this parameter, click outside to disappear//  Set Click Window outside window disappears pop.setoutsidetouchable (false);//  set this parameter to get focus, otherwise you cannot click webview =  (WebView)   View.findviewbyid (R.id.webview1); Webview.requestfocusfromtouch (); Webview.setwebviewclient (new  Webviewclient ()  {@Overridepublic  void onpagefinished (Webview view, string url)  {if  (Null != progressdialog)  {pop.update (150, 0, 800, 1000);p roGressdialog.dismiss ();};}); /  set the WebView property to be able to execute JavaScript script webview.getsettings (). Setjavascriptenabled (True);//  Load the page webview.loadurl ("http://www.baidu.com/") that needs to be displayed;p rogressdialog = progressdialog.show ( View.getcontext (),null,  "page load, please later:"); Progressdialog.setcanceledontouchoutside (True);//pop.showasdropdown (v);p op.showatlocation (Mine.getWindow (). Getdecorview (), gravity.no_gravity , 0, 0);}}

4-point knowledge needs to be recorded

1, Layoutinflater

Custom View

2, Popupwindow

Pop-up box port:

3, ProgressDialog

Progress bar

4,WebView

Web View



A section of Android jump to web interface code

Related Article

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.