我们可以用
onLoadResource
的方法来代替
WebViewClient
。像这样。
webView.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return false;
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
super.onPageStarted(view, url, favicon);
progressDialog.show();
@Override
public void onPageFinished(WebView view, String url) {
super.onPageFinished(view, url);
Log.d("WEBCLIENT", "onPageFinished");
@Override
public void onLoadResource(WebView view, String url) {
super.onLoadResource(view, url);
Log.d("WEBCLIENT","onLoadResource");
if(webView.getProgress() == 100) {
progressDialog.dismiss();