first we put all the images set for the animation in drawable
Then we make a xml file of type animation (that goes in anim folder)
there we write something like this inside animation-list
Then we make a xml file of type animation (that goes in anim folder)
there we write something like this inside animation-list
<item android:drawable="@drawable/animation_00031" android:duration="30"></item> <item android:drawable="@drawable/animation_00032" android:duration="30"></item> <item android:drawable="@drawable/animation_00033" android:duration="30"></item> <item android:drawable="@drawable/animation_00034" android:duration="30"></item> <item android:drawable="@drawable/animation_00035" android:duration="30"></item> <item android:drawable="@drawable/animation_00036" android:duration="30"></item> <item android:drawable="@drawable/animation_00037" android:duration="30"></item>
our main layout just has a imageview for which we will set our xml anil files
final ImageView iv= (ImageView) findViewById(R.id.imageView);
iv.setBackgroundResource(R.anim.frame_animation);
to start animation just do
AnimationDrawable anim = (AnimationDrawable) iv.getBackground();
anim.start();
No comments:
Post a Comment