PictureListener is deprecated and obsolete, is there a replacement?

两盒软妹~` 提交于 2019-12-30 01:46:05

问题


I would like to be notified when an image has been completely draw on the WebView. Using PictureListener and onNewPicture is a common answer (even suggested by the onPageFinished documentation) to this but is listed as deprecated and obsolete. Is there a replacement/alternative?


回答1:


I see with Android 4.0 the doc was updated:

This method is deprecated. Due to internal changes, the picture does not include composited layers such as fixed position elements or scrollable divs. While the PictureListener API can still be used to detect changes in the WebView content, you are advised against its usage until a replacement is provided in a future Android release.

There is no replacement yet.




回答2:


how about

webview.setWebViewClient(new WebViewClient(){

    @Override
    public void onPageFinished(WebView view, String url) {
        // you can get the picture here
        super.onPageFinished(view, url);

    }
});


来源:https://stackoverflow.com/questions/7166534/picturelistener-is-deprecated-and-obsolete-is-there-a-replacement

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!