Animated splash screen with Phonegap

后端 未结 2 2389
感动是毒
感动是毒 2021-02-20 06:36

Is that possible to add animated splash screens for Android and iOS Phonegap apps? I tried to add animated .gif as splash screen file for Android but it doesn\'t work. I.e. ther

2条回答
  •  耶瑟儿~
    2021-02-20 07:17

    I've been searching, and I think that you should create a javascript-android interface and do something like Cordova does.

    This is the Cordova code:

    public class SplashScreen extends Plugin {
    
        @Override
        public PluginResult execute(String action, JSONArray args, String callbackId) {
            PluginResult.Status status = PluginResult.Status.OK;
            String result = "";
    
             if (action.equals("hide")) {
                 this.webView.postMessage("splashscreen", "hide");
             } else if (action.equals("show")){
                 this.webView.postMessage("splashscreen", "show");
             }
             else {
                 status = PluginResult.Status.INVALID_ACTION;
             }
             return new PluginResult(status, result);
         }
    

    And it is invoked throught javascript like this:

     exec(null, null, "SplashScreen", "show", []);
    

    Also you will need to do it for iOS too, see this link: ios fade out splash screen (iphone 5 friendly)

提交回复
热议问题