Android WebView onPageFinished解决返回上一页时标题不刷新

创建时间:2017/10/22 14:09:51
关键字:WebView返回,标题,onPageFinished,onReceivedTitle

WebChromeClient的onReceivedTitle中刷新标题

webView.setWebChromeClient(new WebChromeClient() { 
         public void onReceivedTitle(WebView view, String title) { 
          super.onReceivedTitle(view, title);
             tvTitle.setText(title); 
         } 
     });


调用goback()返回上一页时,上述方法未能调用到。使用以下方法:

WebChromeClient的onPageFinished中刷新标题

webView.setWebViewClient(new WebViewClient() { public void onPageFinished(WebView view, String url) { tvTitle.setText(view.getTitle());
} });