Android APIs
public class

AlphaAnimation

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

Class Overview

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

[Expand]
Inherited XML Attributes
From class android.view.animation.Animation
[Expand]
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
[Expand]
Inherited Methods
From class android.view.animation.Animation
From class java.lang.Object

Public Constructors

public AlphaAnimation (Context context, AttributeSet attrs)

Added in API level 1

Constructor used when an AlphaAnimation is loaded from a resource.

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

public AlphaAnimation (float fromAlpha, float toAlpha)

Added in API level 1

Constructor to use when building an AlphaAnimation from code

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

Public Methods

public boolean willChangeBounds ()

Added in API level 1

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
  • true if this animation will change the view's bounds

public boolean willChangeTransformationMatrix ()

Added in API level 1

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
  • true if this animation will change the transformation matrix

Protected Methods

protected void applyTransformation (float interpolatedTime, Transformation t)

Added in API level 1

Changes the alpha property of the supplied Transformation

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