给webView设置一个webChromeClient,重写里面的onProgressChanged方法,代码如下//pb是进度条ProgressBar
webView.setWebChromeClient(new WebChromeClient() {
@Override
public void onProgressChanged(WebView view, int newProgress) {
pb.setProgress(newProgress);
if(newProgress==100){
pb.setVisibility(View.GONE);
}
}
});