1page.title=Animation 2@jd:body 3 4 <div id="qv-wrapper"> 5 <div id="qv"> 6 7 <h2>See also</h2> 8 <ol> 9 <li><a href="{@docRoot}guide/topics/graphics/prop-animation.html">Property 10Animation</a></li> 11 <li><a href="{@docRoot}guide/topics/graphics/view-animation.html">View Animation</a></li> 12 <li><a href="{@docRoot}guide/topics/graphics/drawable-animation.html">Drawable Animation</a></li> 13 <ol> 14 </div> 15 </div> 16 17 <p>The Android framework provides two animation systems: property animation 18 (introduced in Android 3.0) and view animation. Both animation systems are viable options, 19 but the property animation system, in general, is the preferred method to use, because it 20 is more flexible and offers more features. In addition to these two systems, you can utilize Drawable 21animation, which allows you to load drawable resources and display them one frame after 22another.</p> 23 24 <p>The view animation system provides the capability to only animate {@link android.view.View} 25objects, so if you wanted to animate non-{@link android.view.View} objects, you have to implement 26your own code to do so. The view animation system is also constrained in the fact that it only 27exposes a few aspects of a {@link android.view.View} object to animate, such as the scaling and 28rotation of a View but not the background color, for instance.</p> 29 30 <p>Another disadvantage of the view animation system is that it only modified where the 31 View was drawn, and not the actual View itself. For instance, if you animated a button to move 32 across the screen, the button draws correctly, but the actual location where you can click the 33 button does not change, so you have to implement your own logic to handle this.</p> 34 35 <p>With the property animation system, these constraints are completely removed, and you can animate 36 any property of any object (Views and non-Views) and the object itself is actually modified. 37 The property animation system is also more robust in the way it carries out animation. At 38 a high level, you assign animators to the properties that you want to animate, such as color, 39 position, or size and can define aspects of the animation such as interpolation and 40 synchronization of multiple animators.</p> 41 42 <p>The view animation system, however, takes less time to setup and requires less code to write. 43 If view animation accomplishes everything that you need to do, or if your existing code already 44 works the way you want, there is no need to use the property animation system. It also might 45 make sense to use both animation systems for different situations if the use case arises.</p> 46 47<dl> 48<dt><strong><a href="{@docRoot}guide/topics/graphics/prop-animation.html">Property 49Animation</a></strong></dt> 50<dd>Introduced in Android 3.0 (API level 11), the property animation system lets you 51animate properties of any object, including ones that are not rendered to the screen. The system is 52extensible and lets you animate properties of custom types as well.</dd> 53 54<dt><strong><a href="{@docRoot}guide/topics/graphics/view-animation.html">View 55Animation</a></strong></dt> 56<dd>View Animation is the older system and can only be used for Views. It is relatively easy to 57setup and offers enough capabilities to meet many application's needs.</dd> 58</dl> 59 60<dt><strong><a href="{@docRoot}guide/topics/graphics/drawable-animation.html">Drawable 61Animation</a></strong></dt> 62<dd>Drawable animation involves displaying {@link android.graphics.drawable.Drawable} resources one 63after another, like a roll of film. This method of animation is useful if you want to animate 64things that are easier to represent with Drawable resources, such as a progression of bitmaps.</dd> 65