在Phonegap InAppBrowser中显示加载指示器 [英] Show loading indicator in Phonegap InAppBrowser
本文介绍了在Phonegap InAppBrowser中显示加载指示器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我使用以下代码加载页面时,我试图在Phonegap InAppBrowser中显示加载指示器:
I am trying to display a loading indicator in Phonegap InAppBrowser when a page is loading using the following code:
var ref;
ref = window.open('http://www.google.com', '_top', 'location=no');
ref.addEventListener('loadstart', function(event) {
//navigator.splashscreen.show();
navigator.notification.activityStart("", "loading");
});
ref.addEventListener('loadstop', function(event) {
//navigator.splashscreen.hide();
navigator.notification.activityStop();
});
它不显示指示器.我认为Z索引比InAppBrowser的Z索引低.
It doesn't display the indicator. I think that the z-index is lower then z-index of InAppBrowser.
如果我使用启动画面而不是加载指示器,那么它会起作用.
If I use a splash screen instead of loading indicator it works.
推荐答案
您可以在hidden
模式下打开InAppBrowser
,同时显示微调器,完成加载后隐藏微调器并显示InAppBrowser
:
You can open InAppBrowser
in hidden
mode, meanwhile display a spinner, and when it finishes loading hide the spinner and show the InAppBrowser
:
showSpinner() // implement by yourself
var popup = window.open(url, "_blank", "location=no,toolbar=no,hidden=yes");
popup.addEventListener("loadstop", function() {
popup.show();
hideSpinner(); // implement by yourself
});
这篇关于在Phonegap InAppBrowser中显示加载指示器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文