This example describes an animation that Android plays with multiple images. Share to everyone for your reference, specific as follows:
You can play frames-by-frame images on Android, then produce a dynamic effect, prepare several consecutive pictures, then create a Anim folder under the source Res folder, and create a new XML
The XML code is as follows:
<?xml version= "1.0" encoding= "Utf-8"?> <animation-list xmlns:android=
"http://schemas.android.com/apk" /res/android "
android:oneshot=" true ">
<item android:drawable=" @drawable/c1 "android:duration=" 200 " />
<item android:drawable= "@drawable/c2" android:duration= "/> <item"
@ Drawable/c3 "android:duration="/>
<item android:drawable= "@drawable/c4" android:duration= ""/>
<item android:drawable=, "@drawable/c5" android:duration= "/> <item android:drawable=
" @ Drawable/c6 "android:duration="/>
</animation-list>
Where C1,c2,c3,c4,c5,c6 is the name of the added picture.
Place a ImageView control inside the form and write it in code:
_imageview1 = (ImageView) Findviewbyid (R.ID.IMAGEVIEW1),//placed ImageView control
//Set animation background
_ Imageview1.setbackgroundresource (r.anim.animation_list)//Where r.anim.animation_list is the resource name of the animated description file that was prepared in the previous step.
Get the Animated object
_animaition = (animationdrawable) _imageview1.getbackground ();
Finally, you can start the animation, the code is as follows:
Do you want to start only once?
_animaition.setoneshot (false);
if (_animaition.isrunning ())//is running?
{
_animaition.stop ()//Stop
}
_animaition.start ()/Start
For more information on Android-related content readers can view the site: "Android graphics and image processing skills summary", "Android Development introduction and Advanced Course", "Android debugging techniques and common problems solution summary", " Android Multimedia How-to Summary (audio, video, audio, etc), summary of Android Basic components usage, Android View tips Summary, Android layout layout tips and a summary of Android controls usage
I hope this article will help you with the Android program.