我正在开发android应用程序,我正在尝试显示加载微调器,而我的html正在格式化,但微调器没有显示,我不明白为什么。
这是代码:
$.mobile.loading('show');
if (window.localStorage.getItem("UserTeams") != null && manual == false) {
$(window.localStorage.getItem("UserTeams")).appendTo("#listTeams");
$("#listTeams").listview("refresh").listview();
}
$.mobile.loading('hide');
为什么旋转器没有显示的任何想法?
答案 0 :(得分:1)
尝试通过JavaSriptInterface使用本机函数来显示进度。
JavaScriptInterface:
private final class JavaScriptInterface {
public JavaScriptInterface() {
}
/* progressDialog is a field of Your Activity.
JavaScriptInterface is internal class of Your Activity. */
public void showDialog() {
if (progressDialog != null) {
if (!progressDialog.isShowing()) {
progressDialog = ProgressDialog.show(this, "", getString(R.string.common_loading_upper));
}
}
}
public void hideDialog() {
if (progressDialog != null) {
progressDialog.dismiss();
}
}
}
注册JavaScriptInterface:
webView.addJavascriptInterface(new JavaScriptInterface(), "myinterface");
调用对话框的JavaScript代码:
window.myinterface.showDialog();