0

我正在将WebView' 的可见性更改为可见时onPageFinished()WebView但在呈现新页面之前,前一页可见片刻。

有什么办法可以捕捉到页面渲染完成事件WebView

4

1 回答 1

0

您可以在 setWebViewclient 上检测 webview 的开始和结束

webView.setWebViewClient(new WebViewClient(){
    @Override
    public void onPageStarted(WebView view, String url, Bitmap favicon) {
        // TODO Auto-generated method stub
        super.onPageStarted(view, url, favicon);
    }

    @Override
    public void onPageFinished(WebView view, String url) {
        // TODO Auto-generated method stub
        super.onPageFinished(view, url);
    }

    @Override
    public void onReceivedError(WebView view, int errorCode,String description, String failingUrl) {
        // TODO Auto-generated method stub
        super.onReceivedError(view, errorCode, description, failingUrl);
    }

    @Override
    public void onReceivedLoginRequest(WebView view, String realm,
                    String account, String args) {
        // TODO Auto-generated method stub
        super.onReceivedLoginRequest(view, realm, account, args);
    }
});
于 2014-01-03T00:57:38.673 回答