Home » Android » android – Animated splash screen using .gif

android – Animated splash screen using .gif

Posted by: admin June 15, 2020 Leave a comment

Questions:

I want to use animated gif for the Splash screen. So I change the src in config.xml into my gif like this:

...
<gap:splash gap:density="xhdpi" gap:platform="android" src="res/screen/android/screen-xhdpi-portrait.gif" />
...

But when it runs, the gif image is not animating and only show the first frame.

I have another gif inside the app and it animates well. So I guess the one in splash screen is not WebView?

Is there a way to use gif for splash screen other than customizing the Android Java code?

Thanks

How to&Answers:

In webview .gif works well. In other cases it does not work in android. You need to customize android java code to make it work. But their is an alternative.

If you have the images for all frames (you may also extract them from gif) and use android animation on the images. It will look like gif image only. All i mean is that you can do frame anmations.

This link will give you some idea:

http://mobile.tutsplus.com/tutorials/android/android-sdk-quick-tip-creating-frame-animations/

You may google more to find better tutorial. This kind animation works very well.

Answer:

You may be able to use a Movie instead of a WebView. That class is not well-documented but someone was nice enough to make a walkthrough, albeit one that isn’t specific to splash screens:

http://weavora.com/blog/2012/02/07/android-how-to-use-animated-gif/

I’m not sure if this meets your “other than customizing the Android Java code” requirement, though.