url = getIntent().getStringExtra("url");
mWebView.loadUrl(url);
//得到webView设置
webSettings = mWebView.getSettings();
//mWebView.goBack();浏览器回退到上一页面
//mWebView.goForward();浏览器前进到下一页面
webSettings.setJavaScriptEnabled(true);//设置支持javascript
webSettings.setBuiltInZoomControls(true);//显示缩放按钮(wap网页不支持)
webSettings.setUseWideViewPort(true);//设置双击释放(wap网页不支持,wap已经做了适配)
mWebView.setWebViewClient(new WebViewClient() {
//网页开始加载
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
super.onPageStarted(view, url, favicon);
mProgressBar.setVisibility(View.VISIBLE);
}
//网页结束加载
@Override
public void onPageFinished(WebView view, String url) {
mProgressBar.setVisibility(View.GONE);
super.onPageFinished(view, url);
}
//链接跳转方法
@Override
public boolean shouldOverrideKeyEvent(WebView view, KeyEvent event) {
//设置在webView中浏览网页
view.loadUrl(url);
return true;
}
});
// mWebView.setWebChromeClient(new WebChromeClient() {
// //获取加载进度可以做线性progressbar。
// @Override
// public void onProgressChanged(WebView view, int newProgress) {
// super.onProgressChanged(view, newProgress);
// }
//
// //接收标题
// @Override
// public void onReceivedTitle(WebView view, String title) {
// super.onReceivedTitle(view, title);
// }
// });
联系客服