Monday, 19 August 2013

I want to set an animated image in my application

I want to set an animated image in my application

I want to set an animated image in my application.i use an animation-list
to show it frame by frame but it's not working!! please help me!!
here is Java code
_imagView=(ImageView)findViewById(R.id.imageView1);
_imagView.setBackgroundResource(R.drawable.anim);
AnimationDrawable anim1 = (AnimationDrawable) _imagView.getBackground();
anim1.start();
and here is anim.xml
<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
android:oneshot="false">
<item android:drawable="@drawable/animationchoking0"
android:duration="500" />
<item android:drawable="@drawable/animationchoking1"
android:duration="500" />
<item android:drawable="@drawable/animationchoking2"
android:duration="500" />
<item android:drawable="@drawable/animationchoking3"
android:duration="500" />
<item android:drawable="@drawable/animationchoking4"
android:duration="500" />
<item android:drawable="@drawable/animationchoking5"
android:duration="500" />
<item android:drawable="@drawable/animationchoking6"
android:duration="500" />
<item android:drawable="@drawable/animationchoking7"
android:duration="500" />
<item android:drawable="@drawable/animationchoking8"
android:duration="500" />
</animation-list>

No comments:

Post a Comment