Skip to content

Most visited

Recently visited

navigation
Added in API level 1

Animation

public abstract class Animation
extends Object implements Cloneable

java.lang.Object
   ↳ android.view.animation.Animation
Known Direct Subclasses


Abstraction for an Animation that can be applied to Views, Surfaces, or other objects. See the animation package description file.

Summary

Nested classes

interface Animation.AnimationListener

An animation listener receives notifications from an animation. 

class Animation.Description

Utility class to parse a string description of a size. 

XML attributes

android:detachWallpaper Special option for window animations: if this window is on top of a wallpaper, don't animate the wallpaper with it. 
android:duration Amount of time (in milliseconds) for the animation to run. 
android:fillAfter When set to true, the animation transformation is applied after the animation is over. 
android:fillBefore When set to true or when fillEnabled is not set to true, the animation transformation is applied before the animation has started. 
android:fillEnabled When set to true, the value of fillBefore is taken into account. 
android:interpolator Defines the interpolator used to smooth the animation movement in time. 
android:repeatCount Defines how many times the animation should repeat. 
android:repeatMode Defines the animation behavior when it reaches the end and the repeat count is greater than 0 or infinite. 
android:startOffset Delay in milliseconds before the animation runs, once start time is reached. 
android:zAdjustment Allows for an adjustment of the Z ordering of the content being animated for the duration of the animation. 

Constants

int ABSOLUTE

The specified dimension is an absolute number of pixels.

int INFINITE

Repeat the animation indefinitely.

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.

int RELATIVE_TO_SELF

The specified dimension holds a float and should be multiplied by the height or width of the object being animated.

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.

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).

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.

int ZORDER_BOTTOM

Requests that the content being animated be forced under all other content for the duration of the animation.

int ZORDER_NORMAL

Requests that the content being animated be kept in its current Z order.

int ZORDER_TOP

Requests that the content being animated be forced on top of all other content for the duration of the animation.

Public constructors

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.

Public methods

void cancel()

Cancel the animation.

long computeDurationHint()

Compute a hint at how long the entire animation may last, in milliseconds.

int getBackgroundColor()

Returns the background color behind the animation.

boolean getDetachWallpaper()

Return value of setDetachWallpaper(boolean).

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, float scale)

Gets the transformation to apply at a specified point in time.

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 isFillEnabled()

If fillEnabled is true, this animation will apply the value of fillBefore.

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 setBackgroundColor(int bg)

Set background behind animation.

void setDetachWallpaper(boolean detachWallpaper)

If detachWallpaper is true, and this is a window animation of a window that has a wallpaper background, then the window will be detached from the wallpaper while it runs.

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 setFillEnabled(boolean fillEnabled)

If fillEnabled is true, the animation will apply the value of fillBefore.

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.

Protected methods

void applyTransformation(float interpolatedTime, Transformation t)

Helper for getTransformation.

Animation clone()

Creates and returns a copy of this object.

void ensureInterpolator()

Gurantees that this animation has an interpolator.

void finalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

float getScaleFactor()

The scale factor is set by the call to getTransformation.

float resolveSize(int type, float value, int size, int parentSize)

Convert the information in the description of a size to an actual dimension

Inherited methods

From class java.lang.Object

XML attributes

android:detachWallpaper

Special option for window animations: if this window is on top of a wallpaper, don't animate the wallpaper with it.

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 detachWallpaper.

Related methods:

android:duration

Amount of time (in milliseconds) for the animation to run.

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.

Related methods:

android:fillAfter

When set to true, the animation transformation is applied after the animation is over. The default value is false. If fillEnabled is not set to true and the animation is not set on a View, fillAfter is assumed to be true.

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.

Related methods:

android:fillBefore

When set to true or when fillEnabled is not set to true, the animation transformation is applied before the animation has started. The default value is true.

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.

Related methods:

android:fillEnabled

When set to true, the value of fillBefore is taken into account.

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 fillEnabled.

Related methods:

android:interpolator

Defines the interpolator used to smooth the animation movement in time.

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.

Related methods:

android:repeatCount

Defines how many times the animation should repeat. The default value is 0.

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.

ConstantValueDescription
infinite-1

This corresponds to the global attribute resource symbol repeatCount.

Related methods:

android:repeatMode

Defines the animation behavior when it reaches the end and the repeat count is greater than 0 or infinite. The default value is restart.

Must be one of the following constant values.

ConstantValueDescription
restart1 The animation starts again from the beginning.
reverse2 The animation plays backward.

This corresponds to the global attribute resource symbol repeatMode.

Related methods:

android:startOffset

Delay in milliseconds before the animation runs, once start time is reached.

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.

Related methods:

android:zAdjustment

Allows for an adjustment of the Z ordering of the content being animated for the duration of the animation. The default value is normal.

Must be one of the following constant values.

ConstantValueDescription
normal0 The content being animated be kept in its current Z order.
top1 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.

Related methods:

Constants

ABSOLUTE

Added in API level 1
int ABSOLUTE

The specified dimension is an absolute number of pixels.

Constant Value: 0 (0x00000000)

INFINITE

Added in API level 1
int INFINITE

Repeat the animation indefinitely.

Constant Value: -1 (0xffffffff)

RELATIVE_TO_PARENT

Added in API level 1
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.

Constant Value: 2 (0x00000002)

RELATIVE_TO_SELF

Added in API level 1
int RELATIVE_TO_SELF

The specified dimension holds a float and should be multiplied by the height or width of the object being animated.

Constant Value: 1 (0x00000001)

RESTART

Added in API level 1
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.

Constant Value: 1 (0x00000001)

REVERSE

Added in API level 1
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).

Constant Value: 2 (0x00000002)

START_ON_FIRST_FRAME

Added in API level 1
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. This can is useful for short animations.

Constant Value: -1 (0xffffffff)

ZORDER_BOTTOM

Added in API level 1
int ZORDER_BOTTOM

Requests that the content being animated be forced under all other content for the duration of the animation.

Constant Value: -1 (0xffffffff)

ZORDER_NORMAL

Added in API level 1
int ZORDER_NORMAL

Requests that the content being animated be kept in its current Z order.

Constant Value: 0 (0x00000000)

ZORDER_TOP

Added in API level 1
int ZORDER_TOP

Requests that the content being animated be forced on top of all other content for the duration of the animation.

Constant Value: 1 (0x00000001)

Public constructors

Animation

Added in API level 1
Animation ()

Creates a new animation with a duration of 0ms, the default interpolator, with fillBefore set to true and fillAfter set to false

Animation

Added in API level 1
Animation (Context context, 
                AttributeSet attrs)

Creates a new animation whose parameters come from the specified context and attributes set.

Parameters
context Context: the application environment
attrs AttributeSet: the set of attributes holding the animation parameters

Public methods

cancel

Added in API level 8
void cancel ()

Cancel the animation. Cancelling an animation invokes the animation listener, if set, to notify the end of the animation. If you cancel an animation manually, you must call reset() before starting the animation again.

See also:

computeDurationHint

Added in API level 3
long computeDurationHint ()

Compute a hint at how long the entire animation may last, in milliseconds. Animations can be written to cause themselves to run for a different duration than what is computed here, but generally this should be accurate.

Returns
long

getBackgroundColor

Added in API level 12
int getBackgroundColor ()

Returns the background color behind the animation.

Returns
int

getDetachWallpaper

Added in API level 5
boolean getDetachWallpaper ()

Return value of setDetachWallpaper(boolean).

Related XML Attributes:

Returns
boolean

getDuration

Added in API level 1
long getDuration ()

How long this animation should last

Related XML Attributes:

Returns
long the duration in milliseconds of the animation

getFillAfter

Added in API level 1
boolean getFillAfter ()

If fillAfter is true, this animation will apply its transformation after the end time of the animation.

Related XML Attributes:

Returns
boolean true if the animation applies its transformation after it ends

getFillBefore

Added in API level 1
boolean getFillBefore ()

If fillBefore is true, this animation will apply its transformation before the start time of the animation. If fillBefore is false and fillEnabled is true, the transformation will not be applied until the start time of the animation.

Related XML Attributes:

Returns
boolean true if the animation applies its transformation before it starts

getInterpolator

Added in API level 1
Interpolator getInterpolator ()

Gets the acceleration curve type for this animation.

Related XML Attributes:

Returns
Interpolator the Interpolator associated to this animation

getRepeatCount

Added in API level 1
int getRepeatCount ()

Defines how many times the animation should repeat. The default value is 0.

Related XML Attributes:

Returns
int the number of times the animation should repeat, or INFINITE

getRepeatMode

Added in API level 1
int getRepeatMode ()

Defines what this animation should do when it reaches the end.

Related XML Attributes:

Returns
int either one of REVERSE or RESTART

getStartOffset

Added in API level 1
long getStartOffset ()

When this animation should start, relative to StartTime

Related XML Attributes:

Returns
long the start offset in milliseconds

getStartTime

Added in API level 1
long getStartTime ()

When this animation should start. If the animation has not startet yet, this method might return START_ON_FIRST_FRAME.

Returns
long the time in milliseconds when the animation should start or START_ON_FIRST_FRAME

getTransformation

Added in API level 11
boolean getTransformation (long currentTime, 
                Transformation outTransformation, 
                float scale)

Gets the transformation to apply at a specified point in time. Implementations of this method should always replace the specified Transformation or document they are doing otherwise.

Parameters
currentTime long: Where we are in the animation. This is wall clock time.
outTransformation Transformation: A transformation object that is provided by the caller and will be filled in by the animation.
scale float: Scaling factor to apply to any inputs to the transform operation, such pivot points being rotated or scaled around.
Returns
boolean True if the animation is still running

getTransformation

Added in API level 1
boolean getTransformation (long currentTime, 
                Transformation outTransformation)

Gets the transformation to apply at a specified point in time. Implementations of this method should always replace the specified Transformation or document they are doing otherwise.

Parameters
currentTime long: Where we are in the animation. This is wall clock time.
outTransformation Transformation: A transformation object that is provided by the caller and will be filled in by the animation.
Returns
boolean True if the animation is still running

getZAdjustment

Added in API level 1
int getZAdjustment ()

Returns the Z ordering mode to use while running the animation as previously set by setZAdjustment(int).

Related XML Attributes:

Returns
int Returns one of ZORDER_NORMAL, ZORDER_TOP, or ZORDER_BOTTOM.

hasEnded

Added in API level 1
boolean hasEnded ()

Indicates whether this animation has ended or not.

Returns
boolean true if the animation has ended, false otherwise

hasStarted

Added in API level 1
boolean hasStarted ()

Indicates whether this animation has started or not.

Returns
boolean true if the animation has started, false otherwise

initialize

Added in API level 1
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. (This is to support animation sizes being specified relative to these dimensions.)

Objects that interpret Animations should call this method when the sizes of the object being animated and its parent are known, and before calling getTransformation(long, Transformation).

Parameters
width int: Width of the object being animated
height int: Height of the object being animated
parentWidth int: Width of the animated object's parent
parentHeight int: Height of the animated object's parent

isFillEnabled

Added in API level 3
boolean isFillEnabled ()

If fillEnabled is true, this animation will apply the value of fillBefore.

Related XML Attributes:

Returns
boolean true if the animation will take fillBefore into account

isInitialized

Added in API level 1
boolean isInitialized ()

Whether or not the animation has been initialized.

Returns
boolean Has this animation been initialized.

See also:

reset

Added in API level 1
void reset ()

Reset the initialization state of this animation.

See also:

restrictDuration

Added in API level 1
void restrictDuration (long durationMillis)

Ensure that the duration that this animation will run is not longer than durationMillis. In addition to adjusting the duration itself, this ensures that the repeat count also will not make it run longer than the given time.

Parameters
durationMillis long: The maximum duration the animation is allowed to run.

scaleCurrentDuration

Added in API level 1
void scaleCurrentDuration (float scale)

How much to scale the duration by.

Parameters
scale float: The amount to scale the duration.

setAnimationListener

Added in API level 1
void setAnimationListener (Animation.AnimationListener listener)

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.

Parameters
listener Animation.AnimationListener: the animation listener to be notified

setBackgroundColor

Added in API level 12
void setBackgroundColor (int bg)

Set background behind animation.

Parameters
bg int: The background color. If 0, no background. Currently must be black, with any desired alpha level.

setDetachWallpaper

Added in API level 5
void setDetachWallpaper (boolean detachWallpaper)

If detachWallpaper is true, and this is a window animation of a window that has a wallpaper background, then the window will be detached from the wallpaper while it runs. That is, the animation will only be applied to the window, and the wallpaper behind it will remain static.

Related XML Attributes:

Parameters
detachWallpaper boolean: true if the wallpaper should be detached from the animation

setDuration

Added in API level 1
void setDuration (long durationMillis)

How long this animation should last. The duration cannot be negative.

Related XML Attributes:

Parameters
durationMillis long: Duration in milliseconds
Throws
IllegalArgumentException if the duration is < 0

setFillAfter

Added in API level 1
void setFillAfter (boolean fillAfter)

If fillAfter is true, the transformation that this animation performed will persist when it is finished. Defaults to false if not set. Note that this applies to individual animations and when using an AnimationSet to chain animations.

Related XML Attributes:

Parameters
fillAfter boolean: true if the animation should apply its transformation after it ends

See also:

setFillBefore

Added in API level 1
void setFillBefore (boolean fillBefore)

If fillBefore is true, this animation will apply its transformation before the start time of the animation. Defaults to true if setFillEnabled(boolean) is not set to true. Note that this applies when using an AnimationSet to chain animations. The transformation is not applied before the AnimationSet itself starts.

Related XML Attributes:

Parameters
fillBefore boolean: true if the animation should apply its transformation before it starts

See also:

setFillEnabled

Added in API level 3
void setFillEnabled (boolean fillEnabled)

If fillEnabled is true, the animation will apply the value of fillBefore. Otherwise, fillBefore is ignored and the animation transformation is always applied until the animation ends.

Related XML Attributes:

Parameters
fillEnabled boolean: true if the animation should take the value of fillBefore into account

See also:

setInterpolator

Added in API level 1
void setInterpolator (Context context, 
                int resID)

Sets the acceleration curve for this animation. The interpolator is loaded as a resource from the specified context.

Related XML Attributes:

Parameters
context Context: The application environment
resID int: The resource identifier of the interpolator to load

setInterpolator

Added in API level 1
void setInterpolator (Interpolator i)

Sets the acceleration curve for this animation. Defaults to a linear interpolation.

Related XML Attributes:

Parameters
i Interpolator: The interpolator which defines the acceleration curve

setRepeatCount

Added in API level 1
void setRepeatCount (int repeatCount)

Sets how many times the animation should be repeated. If the repeat count is 0, the animation is never repeated. If the repeat count is greater than 0 or INFINITE, the repeat mode will be taken into account. The repeat count is 0 by default.

Related XML Attributes:

Parameters
repeatCount int: the number of times the animation should be repeated

setRepeatMode

Added in API level 1
void setRepeatMode (int repeatMode)

Defines what this animation should do when it reaches the end. This setting is applied only when the repeat count is either greater than 0 or INFINITE. Defaults to RESTART.

Related XML Attributes:

Parameters
repeatMode int: RESTART or REVERSE

setStartOffset

Added in API level 1
void setStartOffset (long startOffset)

When this animation should start relative to the start time. This is most useful when composing complex animations using an AnimationSet where some of the animations components start at different times.

Related XML Attributes:

Parameters
startOffset long: When this Animation should start, in milliseconds from the start time of the root AnimationSet.

setStartTime

Added in API level 1
void setStartTime (long startTimeMillis)

When this animation should start. When the start time is set to START_ON_FIRST_FRAME, the animation will start the first time getTransformation(long, Transformation) is invoked. The time passed to this method should be obtained by calling currentAnimationTimeMillis() instead of currentTimeMillis().

Parameters
startTimeMillis long: the start time in milliseconds

setZAdjustment

Added in API level 1
void setZAdjustment (int zAdjustment)

Set the Z ordering mode to use while running the animation.

Related XML Attributes:

Parameters
zAdjustment int: The desired mode, one of ZORDER_NORMAL, ZORDER_TOP, or ZORDER_BOTTOM.

start

Added in API level 1
void start ()

Convenience method to start the animation the first time getTransformation(long, Transformation) is invoked.

startNow

Added in API level 1
void startNow ()

Convenience method to start the animation at the current time in milliseconds.

willChangeBounds

Added in API level 1
boolean willChangeBounds ()

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.

Returns
boolean true if this animation will change the view's bounds

willChangeTransformationMatrix

Added in API level 1
boolean willChangeTransformationMatrix ()

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.

Returns
boolean true if this animation will change the transformation matrix

Protected methods

applyTransformation

Added in API level 1
void applyTransformation (float interpolatedTime, 
                Transformation t)

Helper for getTransformation. Subclasses should implement this to apply their transforms given an interpolation value. Implementations of this method should always replace the specified Transformation or document they are doing otherwise.

Parameters
interpolatedTime float: The value of the normalized time (0.0 to 1.0) after it has been run through the interpolation function.
t Transformation: The Transformation object to fill in with the current transforms.

clone

Added in API level 1
Animation clone ()

Creates and returns a copy of this object. The precise meaning of "copy" may depend on the class of the object. The general intent is that, for any object x, the expression:

 x.clone() != x
will be true, and that the expression:
 x.clone().getClass() == x.getClass()
will be true, but these are not absolute requirements. While it is typically the case that:
 x.clone().equals(x)
will be true, this is not an absolute requirement.

By convention, the returned object should be obtained by calling super.clone. If a class and all of its superclasses (except Object) obey this convention, it will be the case that x.clone().getClass() == x.getClass().

By convention, the object returned by this method should be independent of this object (which is being cloned). To achieve this independence, it may be necessary to modify one or more fields of the object returned by super.clone before returning it. Typically, this means copying any mutable objects that comprise the internal "deep structure" of the object being cloned and replacing the references to these objects with references to the copies. If a class contains only primitive fields or references to immutable objects, then it is usually the case that no fields in the object returned by super.clone need to be modified.

The method clone for class Object performs a specific cloning operation. First, if the class of this object does not implement the interface Cloneable, then a CloneNotSupportedException is thrown. Note that all arrays are considered to implement the interface Cloneable and that the return type of the clone method of an array type T[] is T[] where T is any reference or primitive type. Otherwise, this method creates a new instance of the class of this object and initializes all its fields with exactly the contents of the corresponding fields of this object, as if by assignment; the contents of the fields are not themselves cloned. Thus, this method performs a "shallow copy" of this object, not a "deep copy" operation.

The class Object does not itself implement the interface Cloneable, so calling the clone method on an object whose class is Object will result in throwing an exception at run time.

Returns
Animation a clone of this instance.
Throws
CloneNotSupportedException

ensureInterpolator

Added in API level 1
void ensureInterpolator ()

Gurantees that this animation has an interpolator. Will use a AccelerateDecelerateInterpolator is nothing else was specified.

finalize

Added in API level 1
void finalize ()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. A subclass overrides the finalize method to dispose of system resources or to perform other cleanup.

The general contract of finalize is that it is invoked if and when the JavaTM virtual machine has determined that there is no longer any means by which this object can be accessed by any thread that has not yet died, except as a result of an action taken by the finalization of some other object or class which is ready to be finalized. The finalize method may take any action, including making this object available again to other threads; the usual purpose of finalize, however, is to perform cleanup actions before the object is irrevocably discarded. For example, the finalize method for an object that represents an input/output connection might perform explicit I/O transactions to break the connection before the object is permanently discarded.

The finalize method of class Object performs no special action; it simply returns normally. Subclasses of Object may override this definition.

The Java programming language does not guarantee which thread will invoke the finalize method for any given object. It is guaranteed, however, that the thread that invokes finalize will not be holding any user-visible synchronization locks when finalize is invoked. If an uncaught exception is thrown by the finalize method, the exception is ignored and finalization of that object terminates.

After the finalize method has been invoked for an object, no further action is taken until the Java virtual machine has again determined that there is no longer any means by which this object can be accessed by any thread that has not yet died, including possible actions by other objects or classes which are ready to be finalized, at which point the object may be discarded.

The finalize method is never invoked more than once by a Java virtual machine for any given object.

Any exception thrown by the finalize method causes the finalization of this object to be halted, but is otherwise ignored.

Throws
Throwable

getScaleFactor

Added in API level 11
float getScaleFactor ()

The scale factor is set by the call to getTransformation. Overrides of getTransformation(long, Transformation, float) will get this value directly. Overrides of applyTransformation(float, Transformation) can call this method to get the value.

Returns
float float The scale factor that should be applied to pre-scaled values in an Animation such as the pivot points in ScaleAnimation and RotateAnimation.

resolveSize

Added in API level 1
float resolveSize (int type, 
                float value, 
                int size, 
                int parentSize)

Convert the information in the description of a size to an actual dimension

Parameters
type int: One of Animation.ABSOLUTE, Animation.RELATIVE_TO_SELF, or Animation.RELATIVE_TO_PARENT.
value float: The dimension associated with the type parameter
size int: The size of the object being animated
parentSize int: The size of the parent of the object being animated
Returns
float The dimension to use for the animation
This site uses cookies to store your preferences for site-specific language and display options.

Hooray!

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.