animation - Is it possible to make the background of an android app into a animated background like a gif? -
i don't mean make gif background background moves. in advance. appreciated.
android not support gifs. workaround, android offers animation list/animationdrawable. need convert gif individual frames [.png files].
this gif can broken down frames:
save them frame01.png, frame02.png, , on, , create animation-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" />
to begin animation, need cast image animationdrawable
, , call start()
on it
animationdrawable progressanimation = (animationdrawable) yourimageview.getbackground(); progressanimation.start();
- other way:
android provides class android.graphics.movie
. class capable of decoding , playing inputstreams. approach, ca create class gifmovieview
, let inherit view
:
public class gifmovieview extends view
read more in:
http://droid-blog.net/2011/10/14/tutorial-how-to-use-animated-gifs-in-android-part-1/
reference:
Comments
Post a Comment