| page.title=Animation |
| @jd:body |
| |
| <div id="qv-wrapper"> |
| <div id="qv"> |
| |
| <h2>See also</h2> |
| <ol> |
| <li><a href="{@docRoot}guide/topics/graphics/prop-animation.html">Property |
| Animation</a></li> |
| <li><a href="{@docRoot}guide/topics/graphics/view-animation.html">View Animation</a></li> |
| <li><a href="{@docRoot}guide/topics/graphics/drawable-animation.html">Drawable Animation</a></li> |
| <ol> |
| </div> |
| </div> |
| |
| <p>The Android framework provides two animation systems: property animation |
| (introduced in Android 3.0) and view animation. Both animation systems are viable options, |
| but the property animation system, in general, is the preferred method to use, because it |
| is more flexible and offers more features. In addition to these two systems, you can utilize Drawable |
| animation, which allows you to load drawable resources and display them one frame after |
| another.</p> |
| |
| <p>The view animation system provides the capability to only animate {@link android.view.View} |
| objects, so if you wanted to animate non-{@link android.view.View} objects, you have to implement |
| your own code to do so. The view animation system is also constrained in the fact that it only |
| exposes a few aspects of a {@link android.view.View} object to animate, such as the scaling and |
| rotation of a View but not the background color, for instance.</p> |
| |
| <p>Another disadvantage of the view animation system is that it only modified where the |
| View was drawn, and not the actual View itself. For instance, if you animated a button to move |
| across the screen, the button draws correctly, but the actual location where you can click the |
| button does not change, so you have to implement your own logic to handle this.</p> |
| |
| <p>With the property animation system, these constraints are completely removed, and you can animate |
| any property of any object (Views and non-Views) and the object itself is actually modified. |
| The property animation system is also more robust in the way it carries out animation. At |
| a high level, you assign animators to the properties that you want to animate, such as color, |
| position, or size and can define aspects of the animation such as interpolation and |
| synchronization of multiple animators.</p> |
| |
| <p>The view animation system, however, takes less time to setup and requires less code to write. |
| If view animation accomplishes everything that you need to do, or if your existing code already |
| works the way you want, there is no need to use the property animation system. It also might |
| make sense to use both animation systems for different situations if the use case arises.</p> |
| |
| <dl> |
| <dt><strong><a href="{@docRoot}guide/topics/graphics/prop-animation.html">Property |
| Animation</a></strong></dt> |
| <dd>Introduced in Android 3.0 (API level 11), the property animation system lets you |
| animate properties of any object, including ones that are not rendered to the screen. The system is |
| extensible and lets you animate properties of custom types as well.</dd> |
| |
| <dt><strong><a href="{@docRoot}guide/topics/graphics/view-animation.html">View |
| Animation</a></strong></dt> |
| <dd>View Animation is the older system and can only be used for Views. It is relatively easy to |
| setup and offers enough capabilities to meet many application's needs.</dd> |
| </dl> |
| |
| <dt><strong><a href="{@docRoot}guide/topics/graphics/drawable-animation.html">Drawable |
| Animation</a></strong></dt> |
| <dd>Drawable animation involves displaying {@link android.graphics.drawable.Drawable} resources one |
| after another, like a roll of film. This method of animation is useful if you want to animate |
| things that are easier to represent with Drawable resources, such as a progression of bitmaps.</dd> |