重写WebChromeClient一个方法进行进度条显示:
@Override
public void onProgressChanged(WebView view, final int newProgress) {
// 当加载到100%的时候 进度条自动消失
// mCon.setProgress(newProgress * 100);
Trace.i("newProgress is --->" + newProgress);
mHandler.post(new Runnable() {
@Override
public void run() {
if (newProgress <= 15) {
mCon.showLoadingDialog();
} else if (newProgress == 100) {
mCon.hideLoadingDialog();
}
}
});
super.onProgressChanged(view, newProgress);
}