Tuesday, 9 December 2014

How to animate an Animation in Android



i want to ask that i want to make this animation as single image and wanted to apply some other view animation on it like move or alpha etc. how this can be done ? any idea ? simply i wanted to apply view animation on drawable animation.


i have some drawable like s1,s2,s3,s4 to s16 the XML is



<animation-list xmlns:android="http://ift.tt/nIICcg"
android:oneshot="false">
<item android:drawable="@drawable/s1" android:duration="200" />
<item android:drawable="@drawable/s2" android:duration="200" />
<item android:drawable="@drawable/s3" android:duration="200" />
<item android:drawable="@drawable/s12" android:duration="200" />
<item android:drawable="@drawable/s13" android:duration="200" />
<item android:drawable="@drawable/s14" android:duration="200" />
<item android:drawable="@drawable/s15" android:duration="200" />
<item android:drawable="@drawable/s16" android:duration="200" />

</animation-list>


and java code is



anim = (ImageView) findViewById(R.id.black);
anim.setBackgroundResource(R.drawable.smurf);
AnimationDrawable hello = (AnimationDrawable) anim.getBackground();
hello.start();


here smurf in drawable is the xml file for drawable animation.


No comments:

Post a Comment