The android natively has no resource for .gif lively.
For you to do this effect we will have to have all the animation images available to be added in one xml.
Then create an xml called animation.xml and add this content to it:
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
id="animacao" android:oneshot="false" >
<item android:drawable="@drawable/android1" android:duration="150" />
<item android:drawable="@drawable/android2" android:duration="150" />
<item android:drawable="@drawable/android3" android:duration="150" />
<item android:drawable="@drawable/android4" android:duration="150" />
<item android:drawable="@drawable/android5" android:duration="150" />
<item android:drawable="@drawable/android6" android:duration="150" />
<item android:drawable="@drawable/android7" android:duration="150" />
</animation-list>
And in the xml of your Activity create a ImageView
<ImageView android:layout_height="wrap_content"
android:layout_width="wrap_content" android:id="@+id/imgAndroid"
android:background="@drawable/android1"
android:layout_gravity="center_horizontal" />
Now in your Activity class link the ImageView and create a AnimationDrawable implementing your class in this way:
import android.app.Activity;
import android.graphics.drawable.AnimationDrawable;
import android.os.Bundle;
import android.widget.ImageView;
public class Main extends Activity {
private ImageView imgAndroid;
private AnimationDrawable mAnimation;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
imgAndroid = (ImageView)findViewById(R.id.imgAndroid);
imgAndroid.setBackgroundResource(R.drawable.animation);
mAnimation = (AnimationDrawable)imgAndroid.getBackground();
mAnimation.start();
}
}
And to stop the animation use: mAnimation.stop();
The idea of android has never been to support gif, instead try using Animation and SVG
– rochasdv