WebView(1) AndroidManifest.xml
<uses-permission android:name="android.permission.INTERNET" />
(2) 如果是调用系统自带浏览器:
Uri uri = Uri.parse(url);
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
webview.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
});
webview.loadUrl(url);
WebViewTest.zip 源代码