Is it possible to make the background of an Android application in an animated background, like a gif?

I do not mean creating a gif on the background of only the background that is moving. Thanks in advance. Any help is appreciated.

+4
source share
2 answers

Android does not support GIF. As a workaround, Android offers an Animation List / AnimationDrawable . You will need to convert the GIF into separate frames [.png files].

Original GIF image

This GIF can be divided into its frames:

GIF frames in GIMP

Save them as frame01.png, frame02.png, etc. and create an animated list XML file, say progress_animation.xml

<animation-list android:id="@+id/selected" android:oneshot="false">
<item android:drawable="@drawable/frame01" android:duration="50" />
<item android:drawable="@drawable/frame02" android:duration="50" />
<item android:drawable="@drawable/frame03" android:duration="50" />
....
<item android:drawable="@drawable/frameN" android:duration="50" />

, AnimationDrawable start()

AnimationDrawable progressAnimation = (AnimationDrawable) yourImageView.getBackground();
progressAnimation.start();
  • :

Android android.graphics.Movie. InputStreams. GifMovieView View:

public class GifMovieView extends View

:

http://droid-blog.net/2011/10/14/tutorial-how-to-use-animated-gifs-in-android-part-1/

:

.GIF Android

+4

GIF Android, . , GIF, :

  • , . TextView tv;
  • , . tv.setText("")
  • . tv.setBackground("Background here")
  • tv.setAnimation(myAnimation)
  • tv.startAnimation();

. .

+2

All Articles