Skip to content

Most visited

Recently visited

navigation

AnimationUtils

public class AnimationUtils
extends Object

java.lang.Object
   ↳ android.view.animation.AnimationUtils


Defines common utilities for working with animations.

Summary

Public constructors

AnimationUtils()

Public methods

static long currentAnimationTimeMillis()

Returns the current animation time in milliseconds.

static Animation loadAnimation(Context context, int id)

Loads an Animation object from a resource

static Interpolator loadInterpolator(Context context, int id)

Loads an Interpolator object from a resource

static LayoutAnimationController loadLayoutAnimation(Context context, int id)

Loads a LayoutAnimationController object from a resource

static Animation makeInAnimation(Context c, boolean fromLeft)

Make an animation for objects becoming visible.

static Animation makeInChildBottomAnimation(Context c)

Make an animation for objects becoming visible.

static Animation makeOutAnimation(Context c, boolean toRight)

Make an animation for objects becoming invisible.

Inherited methods

From class java.lang.Object

Public constructors

AnimationUtils

added in API level 1
AnimationUtils ()

Public methods

currentAnimationTimeMillis

added in API level 1
long currentAnimationTimeMillis ()

Returns the current animation time in milliseconds. This time should be used when invoking setStartTime(long). Refer to SystemClock for more information about the different available clocks. The clock used by this method is not the "wall" clock (it is not currentTimeMillis()).

Returns
long the current animation time in milliseconds

See also:

loadAnimation

added in API level 1
Animation loadAnimation (Context context, 
                int id)

Loads an Animation object from a resource

Parameters
context Context: Application context used to access resources

id int: The resource id of the animation to load

Returns
Animation The animation object reference by the specified id

Throws
Resources.NotFoundException when the animation cannot be loaded

loadInterpolator

added in API level 1
Interpolator loadInterpolator (Context context, 
                int id)

Loads an Interpolator object from a resource

Parameters
context Context: Application context used to access resources

id int: The resource id of the animation to load

Returns
Interpolator The animation object reference by the specified id

Throws
Resources.NotFoundException

loadLayoutAnimation

added in API level 1
LayoutAnimationController loadLayoutAnimation (Context context, 
                int id)

Loads a LayoutAnimationController object from a resource

Parameters
context Context: Application context used to access resources

id int: The resource id of the animation to load

Returns
LayoutAnimationController The animation object reference by the specified id

Throws
Resources.NotFoundException when the layout animation controller cannot be loaded

makeInAnimation

added in API level 1
Animation makeInAnimation (Context c, 
                boolean fromLeft)

Make an animation for objects becoming visible. Uses a slide and fade effect.

Parameters
c Context: Context for loading resources

fromLeft boolean: is the object to be animated coming from the left

Returns
Animation The new animation

makeInChildBottomAnimation

added in API level 1
Animation makeInChildBottomAnimation (Context c)

Make an animation for objects becoming visible. Uses a slide up and fade effect.

Parameters
c Context: Context for loading resources

Returns
Animation The new animation

makeOutAnimation

added in API level 1
Animation makeOutAnimation (Context c, 
                boolean toRight)

Make an animation for objects becoming invisible. Uses a slide and fade effect.

Parameters
c Context: Context for loading resources

toRight boolean: is the object to be animated exiting to the right

Returns
Animation The new animation

This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields

Hooray!

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

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.

Take a one-minute survey?
Help us improve Android tools and documentation.