Skip to content

Most visited

Recently visited

navigation

AlphaAnimation

public class AlphaAnimation
extends Animation

java.lang.Object
   ↳ android.view.animation.Animation
     ↳ android.view.animation.AlphaAnimation


An animation that controls the alpha level of an object. Useful for fading things in and out. This animation ends up changing the alpha property of a Transformation

Summary

Inherited XML attributes

From class android.view.animation.Animation

Inherited constants

From class android.view.animation.Animation

Public constructors

AlphaAnimation(Context context, AttributeSet attrs)

Constructor used when an AlphaAnimation is loaded from a resource.

AlphaAnimation(float fromAlpha, float toAlpha)

Constructor to use when building an AlphaAnimation from code

Public methods

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)

Changes the alpha property of the supplied Transformation

Inherited methods

From class android.view.animation.Animation
From class java.lang.Object

Public constructors

AlphaAnimation

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

Constructor used when an AlphaAnimation is loaded from a resource.

Parameters
context Context: Application context to use
attrs AttributeSet: Attribute set from which to read values

AlphaAnimation

Added in API level 1
AlphaAnimation (float fromAlpha, 
                float toAlpha)

Constructor to use when building an AlphaAnimation from code

Parameters
fromAlpha float: Starting alpha value for the animation, where 1.0 means fully opaque and 0.0 means fully transparent.
toAlpha float: Ending alpha value for the animation.

Public methods

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)

Changes the alpha property of the supplied Transformation

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

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