my question might seem simple. I want to insert this kind of image as a background on the activity.(Normal images can be inserted by android:background or setBackground which are in drawable resources). But is this kind of images insertions possible at all? Or any other alternative way to achieve this? Please suggest.
Asked
Active
Viewed 437 times
1 Answers
1
Android doesn't really support animated gifs in an easy manner, so that goes out the window. You can have a layout with a background drawable, that you can use an AsyncTask
or Handler
to loop through the images. The background layout would contain all your UI elements (or other layouts with your UI elements) and the layout_width
and layout_height
be set to "match_parent"
.

ajacian81
- 7,419
- 9
- 51
- 64
-
1Thank you so much for your quick response +1. But I guess we need to have minimum 3-4 images of the movement sequences in order to have it visible like it is moving. If so how can I get the images of different positions? – hrithik Oct 19 '12 at 04:38
-
If you're going from an animated gif, you can use an application like gifsplitter which I got from this thread: http://stackoverflow.com/questions/3660209/android-display-animated-gif . I once tried the first method in this answer and like one of the comments indicated, sometimes the colours aren't depicted properly. – ajacian81 Oct 19 '12 at 04:42
-
Image splitter reduces the image clarity – Kanth Oct 19 '12 at 09:58
-
@ajacian81 How to loop through images. I split the images from the gifsplitter. But how to loop them programatically in order to set as background. Have checked [this link](http://stackoverflow.com/questions/3137183/android-looping-through-pictures-and-setting-each-as-background "optional title"), but not getting the second option on how to do. Please suggest – hrithik Oct 19 '12 at 10:01