Android的web视图:当页面已经呈现检测 [英] Android Webview : detecting when page has rendered

查看:218
本文介绍了Android的web视图:当页面已经呈现检测的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写一个使用了很多网页视图的highbred Android应用程序。的问题是,当一个页被加载的网页视图的onPageFinished事件被触发,但可能尚未呈现

I am writing a highbred Android app that uses a lot of webviews. The problem is that the onPageFinished event for a webview is fired when a page is loaded but may not be rendered yet.

我相信有一个onNewPicture但由于12版已被删除。

I believe there was a onNewPicture but has been removed since version 12.

有没有人在同样的问题来了,我之前微调页面实际呈现基本上消失,约3-4秒。

Has anyone come across the same issue, my spinner basically disappears about 3-4 seconds before the page is actually rendered.

推荐答案

网页视图的渲染可能需要很长的时间长文档,确实的 onNewPicture 从此API 12(蜂窝3.1)pcated被撤销$ p $和返回自API级别18(杰利贝恩4.3)一个空的图片。

Rendering of a WebView can take a long time for long documents, and indeed onNewPicture has been deprecated since API 12 (Honeycomb 3.1) and returns a null picture since API level 18 (Jellybean 4.3).

我已经测试了API级别17(JB 4.2),它仍然能正常工作。在18 API可能正常工作太多,如果你并不需要实际的图片详细信息。

I have tested for API level 17 (JB 4.2), and it still works fine. Probably works fine in API 18 too if you don't need the actual Picture details.

请在问题跟踪所以我们可以得到一个无德precated更换。

Please this issue on the issue tracker so we can get a non-deprecated replacement.

if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.JELLY_BEAN_MR1) {
        PictureListener pictureListener = new PictureListener() {
            @Override
            @Deprecated
            public void onNewPicture(WebView view, Picture picture) {
                Log.i(TAG, "Picture changed!");
            }

        };
        webView.setPictureListener(pictureListener);
}

这篇关于Android的web视图:当页面已经呈现检测的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆