Property Animation is a powerful animation framework introduced in Android 3.0 (API 11). Unlike the older View Animation (tween animation) system, property animation actually changes the properties of the target object, not just its rendered appearance.
Why Property Animation?
The legacy View Animation system (android.view.animation.Animation) had a fundamental flaw: it only changed where a View was drawn, not its actual properties. For example, if you animated a Button to move to the right side of the screen, clicking the original position would still trigger the button — because the View’s clickable region never moved. Property animation solves this by directly modifying the actual property values (like x, y, alpha) of the target object.
Core APIs
The core classes reside in the android.animation package:
ObjectAnimator
The most commonly used class. It directly animates a named property of a target object:
| |
ValueAnimator
A lower-level class that animates values without applying them to any specific object. You must provide an update listener to apply each frame’s value:
| |
AnimatorSet
Used to orchestrate multiple animations — playing them together, sequentially, or with delays:
| |
Configurable Properties
| Property | Description | Default |
|---|---|---|
| Duration | How long the animation runs | 300ms |
| TimeInterpolator | Controls the rate of change | AccelerateDecelerateInterpolator |
| RepeatCount | Number of times to repeat | 0 (no repeat) |
| RepeatMode | RESTART or REVERSE | RESTART |
| StartDelay | Delay before animation starts | 0 |
| FrameRefreshDelay | Frame refresh interval (rarely changed) | 10ms |
Note: The actual frame rate depends not only on the configured delay but also on system performance and resource usage.
Interpolators
Android provides several built-in interpolators:
LinearInterpolator— constant speedAccelerateDecelerateInterpolator— accelerate then decelerateAccelerateInterpolator— accelerate onlyDecelerateInterpolator— decelerate onlyBounceInterpolator— bounce effect at the endAnticipateOvershootInterpolator— pull back then overshoot the target
You can also implement TimeInterpolator to create custom interpolators.
ViewPropertyAnimator
For simple multi-property view animations, ViewPropertyAnimator provides a fluent API:
| |
Animation Listeners
Use AnimatorListener or the convenience class AnimatorListenerAdapter to react to animation events:
| |