See Also: AnimationDrawable
public class AnimationDrawable : DrawableContainer, IAnimatable, IRunnable, IDisposable
An object used to create frame-by-frame animations, defined by a series of Drawable objects, which can be used as a View object's background.
The simplest way to create a frame-by-frame animation is to define the animation in an XML file, placed in the res/drawable/ folder, and set it as the background to a View object. Then, call AnimationDrawable.Start to run the animation.
An AnimationDrawable defined in XML consists of a single <animation-list> element and a series of nested <item> tags. Each item defines a frame of the animation. See the example below.
spin_animation.xml file in res/drawable/ folder:
Here is the code to load and play this animation.
// Load the ImageView that will host the animation and // set its background to our AnimationDrawable XML resource. ImageView img = (ImageView)findViewById(R.id.spinning_wheel_image); img.setBackgroundResource(R.drawable.spin_animation); // Get the background, which has been compiled to an AnimationDrawable object. AnimationDrawable frameAnimation = (AnimationDrawable) img.getBackground(); // Start the animation (looped playback by default). frameAnimation.start();
For more information about animating with AnimationDrawable, read the Drawable Animation developer guide.
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 1
The members of Android.Graphics.Drawables.AnimationDrawable are listed below.
See Also: DrawableContainer