【发布时间】:2013-12-15 10:46:55
【问题描述】:
在我的 android 应用程序中,我有一个加载 javascript 文件的 webview。
javascript 依次加载一些图像。
//javascript file
var imageObj = new Image();
imageObj.onload = function() {
// my images is fully loaded
console.log("image is loaded!");
}
imageObj.src = src;
我想在所有图像完成加载后显示 webview,但似乎 onProgressChanged 被称为 为时过早 且 newProgress == 100。
//java
@Override
public void onProgressChanged(WebView view, int newProgress) {
super.onProgressChanged(view, newProgress);
if (newProgress == 100) {
mDecorView.addView(view);
// this is called, but I see the that sometimes the webview didn't finish loading all images.
}
}
什么时候调用这个事件?
有没有更好的选择来实现这一点?
【问题讨论】:
标签: javascript android webview webchromeclient