使用 Worklight 时,您可以在 onWLInitCompleted 方法中显示启动画面,并将 onCreate 方法保留为默认值。
下面是 Nexus 4、Andriod 4.2.2 上的代码测试。
@Override
public void onWLInitCompleted(Bundle savedInstanceState) {
// set splash screen image
super.setIntegerProperty("splashscreen", R.drawable.logo_image);
// Set skin name to skip load skinLoader.html if you have no customized skin.
// This will fix the splash screen flicker on some Android devices when the App first time running.
WLUtils.writeWLPref(getContext(), "wlSkinName", "default");
WLUtils.writeWLPref(getContext(), "exitOnSkinLoader", "true");
// show splash screen 3 seconds
super.loadUrl(getWebMainFilePath(), 3000);
}