650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/4A/2E/wKioL1Qjtm3CHPWPAAEJyRaAG04153.jpg "title=" ZBFJNB %g_[{5gg (' a06l%b0.jpg ' alt= "wkiol1qjtm3chpwpaaejyraag04153.jpg"/>
1. Write the interface
<webview
Android:id= "@+id/webview"
Android:layout_width= "Match_parent"
android:layout_height= "Match_parent"/>
2. Permission to apply
<uses-permission android:name= "Android.permission.INTERNET"/>
3, Mainactivity.java
Package Com.malakana.webview;
Import Android.os.Bundle;
Import Android.annotation.SuppressLint;
Import android.app.Activity;
Import Android.webkit.WebView;
Import android.webkit.WebViewClient;
public class Mainactivity extends Activity {
@SuppressLint ("setjavascriptenabled")
@Override
protected void OnCreate (Bundle savedinstancestate) {
Super.oncreate (savedinstancestate);
Setcontentview (R.layout.activity_main);
WebView WebView = (WebView) Findviewbyid (R.id.webview);
Webview.getsettings (). Setjavascriptenabled (True); Enable JavaScript
Webview.setwebviewclient (New Webviewclientdemo ());
Webview.loadurl ("http://www.sina.com.cn"); Loading Web pages
Webview.loadurl ("http://www.nuc.edu.cn/");
}
Private class Webviewclientdemo extends Webviewclient
{
public boolean shouldoverrideurlloading (WebView view,string URL)
{
View.loadurl (URL); Browse Web pages in WebView instead of invoking a system browser
return true;
}
}
}
Android Browse the Web