如何监听 WebView 完成加载 URL?

How to listen for a WebView finishing loading a URL?(如何监听 WebView 完成加载 URL?)

本文介绍了如何监听 WebView 完成加载 URL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

I have a WebView that is loading a page from the Internet. I want to show a ProgressBar until the loading is complete.

How do I listen for the completion of page loading of a WebView?

解决方案

Extend WebViewClient and call onPageFinished() as follows:

mWebView.setWebViewClient(new WebViewClient() {

   public void onPageFinished(WebView view, String url) {
        // do your stuff here
    }
});

这篇关于如何监听 WebView 完成加载 URL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:如何监听 WebView 完成加载 URL?