java.lang.Object | ||
android.view.animation.Animation |
Abstraction for an Animation that can be applied to Views, Surfaces, or other objects. See the animation package description file.
Animation.AnimationListener | An animation listener receives notifications from an animation. |
Animation.Description | Utility class to parse a string description of a size. |
Attribute name | Related methods | |
---|---|---|
android:duration | setDuration(long) |
Amount of time (in milliseconds) for the animation to run. |
android:fillAfter | setFillAfter(boolean) |
When set to true, the animation transformation is applied after the animation is over. |
android:fillBefore | setFillBefore(boolean) |
When set to true, the animation transformation is applied before the animation has started. |
android:interpolator | setInterpolator(Interpolator) |
Defines the interpolator used to smooth the animation movement in time. |
android:repeatCount | setRepeatCount(int) |
Defines how many times the animation should repeat. |
android:repeatMode | setRepeatMode(int) |
Defines the animation behavior when it reaches the end and the repeat count is greater than 0 or infinite. |
android:startOffset | setStartOffset(long) |
Delay in milliseconds before the animation runs, once start time is reached. |
android:zAdjustment | setZAdjustment(int) |
Allows for an adjustment of the Z ordering of the content being animated for the duration of the animation. |
Value | ||||
---|---|---|---|---|
int | ABSOLUTE | The specified dimension is an absolute number of pixels. | 0 | 0x00000000 |
int | INFINITE | Repeat the animation indefinitely. | -1 | 0xffffffff |
int | RELATIVE_TO_PARENT | The specified dimension holds a float and should be multiplied by the height or width of the parent of the object being animated. | 2 | 0x00000002 |
int | RELATIVE_TO_SELF | The specified dimension holds a float and should be multiplied by the height or width of the object being animated. | 1 | 0x00000001 |
int | RESTART | When the animation reaches the end and the repeat count is INFINTE_REPEAT or a positive value, the animation restarts from the beginning. | 1 | 0x00000001 |
int | REVERSE | When the animation reaches the end and the repeat count is INFINTE_REPEAT or a positive value, the animation plays backward (and then forward again). | 2 | 0x00000002 |
int | START_ON_FIRST_FRAME | Can be used as the start time to indicate the start time should be the current time when getTransformation(long, Transformation) is invoked for the first animation frame. | -1 | 0xffffffff |
int | ZORDER_BOTTOM | Requests that the content being animated be forced under all other content for the duration of the animation. | -1 | 0xffffffff |
int | ZORDER_NORMAL | Requests that the content being animated be kept in its current Z order. | 0 | 0x00000000 |
int | ZORDER_TOP | Requests that the content being animated be forced on top of all other content for the duration of the animation. | 1 | 0x00000001 |
Animation() | ||||||
Creates a new animation with a duration of 0ms, the default interpolator, with fillBefore set to true and fillAfter set to false | ||||||
Animation(Context context, AttributeSet attrs) | ||||||
Creates a new animation whose parameters come from the specified context and attributes set. |
long | getDuration() | |||||
How long this animation should last | ||||||
boolean | getFillAfter() | |||||
If fillAfter is true, this animation will apply its transformation after the end time of the animation. | ||||||
boolean | getFillBefore() | |||||
If fillBefore is true, this animation will apply its transformation before the start time of the animation. | ||||||
Interpolator | getInterpolator() | |||||
Gets the acceleration curve type for this animation. | ||||||
int | getRepeatCount() | |||||
Defines how many times the animation should repeat. | ||||||
int | getRepeatMode() | |||||
Defines what this animation should do when it reaches the end. | ||||||
long | getStartOffset() | |||||
When this animation should start, relative to StartTime | ||||||
long | getStartTime() | |||||
When this animation should start. | ||||||
boolean | getTransformation(long currentTime, Transformation outTransformation) | |||||
Gets the transformation to apply at a specified point in time. | ||||||
int | getZAdjustment() | |||||
Returns the Z ordering mode to use while running the animation as previously set by setZAdjustment(int). | ||||||
boolean | hasEnded() | |||||
Indicates whether this animation has ended or not. |
||||||
boolean | hasStarted() | |||||
Indicates whether this animation has started or not. |
||||||
void | initialize(int width, int height, int parentWidth, int parentHeight) | |||||
Initialize this animation with the dimensions of the object being animated as well as the objects parents. | ||||||
boolean | isInitialized() | |||||
Whether or not the animation has been initialized. | ||||||
void | reset() | |||||
Reset the initialization state of this animation. | ||||||
void | restrictDuration(long durationMillis) | |||||
Ensure that the duration that this animation will run is not longer than durationMillis. | ||||||
void | scaleCurrentDuration(float scale) | |||||
How much to scale the duration by. | ||||||
void | setAnimationListener(Animation.AnimationListener listener) | |||||
Binds an animation listener to this animation. |
||||||
void | setDuration(long durationMillis) | |||||
How long this animation should last. | ||||||
void | setFillAfter(boolean fillAfter) | |||||
If fillAfter is true, the transformation that this animation performed will persist when it is finished. | ||||||
void | setFillBefore(boolean fillBefore) | |||||
If fillBefore is true, this animation will apply its transformation before the start time of the animation. | ||||||
void | setInterpolator(Context context, int resID) | |||||
Sets the acceleration curve for this animation. | ||||||
void | setInterpolator(Interpolator i) | |||||
Sets the acceleration curve for this animation. | ||||||
void | setRepeatCount(int repeatCount) | |||||
Sets how many times the animation should be repeated. | ||||||
void | setRepeatMode(int repeatMode) | |||||
Defines what this animation should do when it reaches the end. | ||||||
void | setStartOffset(long startOffset) | |||||
When this animation should start relative to the start time. | ||||||
void | setStartTime(long startTimeMillis) | |||||
When this animation should start. | ||||||
void | setZAdjustment(int zAdjustment) | |||||
Set the Z ordering mode to use while running the animation. | ||||||
void | start() | |||||
Convenience method to start the animation the first time getTransformation(long, Transformation) is invoked. | ||||||
void | startNow() | |||||
Convenience method to start the animation at the current time in milliseconds. | ||||||
boolean | willChangeBounds() | |||||
Indicates whether or not this animation will affect the bounds of the animated view. |
||||||
boolean | willChangeTransformationMatrix() | |||||
Indicates whether or not this animation will affect the transformation matrix. |
void | applyTransformation(float interpolatedTime, Transformation t) | |||||
Helper for getTransformation. | ||||||
void | ensureInterpolator() | |||||
Gurantees that this animation has an interpolator. | ||||||
float | resolveSize(int type, float value, int size, int parentSize) | |||||
Convert the information in the description of a size to an actual dimension |
Must be an integer value, such as "100
".
This may also be a reference to a resource (in the form
"@[package:]type:name
") or
theme attribute (in the form
"?[package:][type:]name
")
containing a value of this type.
This corresponds to the global attribute resource symbol duration.
Must be a boolean value, either "true
" or "false
".
This may also be a reference to a resource (in the form
"@[package:]type:name
") or
theme attribute (in the form
"?[package:][type:]name
")
containing a value of this type.
This corresponds to the global attribute resource symbol fillAfter.
Must be a boolean value, either "true
" or "false
".
This may also be a reference to a resource (in the form
"@[package:]type:name
") or
theme attribute (in the form
"?[package:][type:]name
")
containing a value of this type.
This corresponds to the global attribute resource symbol fillBefore.
Must be a reference to another resource, in the form "@[+][package:]type:name
"
or to a theme attribute in the form "?[package:][type:]name
".
This corresponds to the global attribute resource symbol interpolator.
May be an integer value, such as "100
".
This may also be a reference to a resource (in the form
"@[package:]type:name
") or
theme attribute (in the form
"?[package:][type:]name
")
containing a value of this type.
May be one of the following constant values.
Constant | Value | Description |
---|---|---|
infinite | -1 |
This corresponds to the global attribute resource symbol repeatCount.
Must be one of the following constant values.
Constant | Value | Description |
---|---|---|
restart | 1 | The animation starts again from the beginning. |
reverse | 2 | The animation plays backward. |
This corresponds to the global attribute resource symbol repeatMode.
Must be an integer value, such as "100
".
This may also be a reference to a resource (in the form
"@[package:]type:name
") or
theme attribute (in the form
"?[package:][type:]name
")
containing a value of this type.
This corresponds to the global attribute resource symbol startOffset.
Must be one of the following constant values.
Constant | Value | Description |
---|---|---|
normal | 0 | The content being animated be kept in its current Z order. |
top | 1 | The content being animated is forced on top of all other content for the duration of the animation. |
bottom | -1 | The content being animated is forced under all other content for the duration of the animation. |
This corresponds to the global attribute resource symbol zAdjustment.
context | the application environment |
---|---|
attrs | the set of attributes holding the animation parameters |
currentTime | Where we are in the animation. This is wall clock time. |
---|---|
outTransformation | A tranformation object that is provided by the caller and will be filled in by the animation. |
Indicates whether this animation has ended or not.
Indicates whether this animation has started or not.
Objects that interpret a Animations should call this method when the sizes of the object being animated and its parent are known, and before calling getTransformation(long, Transformation).
width | Width of the object being animated |
---|---|
height | Height of the object being animated |
parentWidth | Width of the animated object's parent |
parentHeight | Height of the animated object's parent |
durationMillis | The maximum duration the animation is allowed to run. |
---|
scale | The amount to scale the duration. |
---|
Binds an animation listener to this animation. The animation listener is notified of animation events such as the end of the animation or the repetition of the animation.
listener | the animation listener to be notified |
---|
durationMillis | Duration in milliseconds |
---|
fillAfter | true if the animation should apply its transformation after it ends |
---|
fillBefore | true if the animation should apply its transformation before it starts |
---|
context | The application environment |
---|---|
resID | The resource identifier of the interpolator to load |
i | The interpolator which defines the acceleration curve |
---|
repeatCount | the number of times the animation should be repeated |
---|
startOffset | When this Animation should start, in milliseconds from the start time of the root AnimationSet. |
---|
startTimeMillis | the start time in milliseconds |
---|
zAdjustment | The desired mode, one of ZORDER_NORMAL, ZORDER_TOP, or ZORDER_BOTTOM. |
---|
Indicates whether or not this animation will affect the bounds of the animated view. For instance, a fade animation will not affect the bounds whereas a 200% scale animation will.
Indicates whether or not this animation will affect the transformation matrix. For instance, a fade animation will not affect the matrix whereas a scale animation will.
interpolatedTime | The value of the normalized time (0.0 to 1.0) after it has been run through the interpolation function. |
---|---|
t | The Transofrmation object to fill in with the current transforms. |
type | One of Animation.ABSOLUTE, Animation.RELATIVE_TO_SELF, or Animation.RELATIVE_TO_PARENT. |
---|---|
value | The dimension associated with the type parameter |
size | The size of the object being animated |
parentSize | The size of the parent of the object being animated |
Copyright 2007 Google Inc. | Build 0.9_r1-98467 - 14 Aug 2008 18:56 |