FileDocCategorySizeDatePackage
AlphaAnimation.javaAPI DocAndroid 5.1 API2747Thu Mar 12 22:22:10 GMT 2015android.view.animation

AlphaAnimation

public class AlphaAnimation extends Animation
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 {@link Transformation}

Fields Summary
private float
mFromAlpha
private float
mToAlpha
Constructors Summary
public AlphaAnimation(android.content.Context context, android.util.AttributeSet attrs)
Constructor used when an AlphaAnimation is loaded from a resource.

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

        super(context, attrs);
        
        TypedArray a =
            context.obtainStyledAttributes(attrs, com.android.internal.R.styleable.AlphaAnimation);
        
        mFromAlpha = a.getFloat(com.android.internal.R.styleable.AlphaAnimation_fromAlpha, 1.0f);
        mToAlpha = a.getFloat(com.android.internal.R.styleable.AlphaAnimation_toAlpha, 1.0f);
        
        a.recycle();
    
public AlphaAnimation(float fromAlpha, float toAlpha)
Constructor to use when building an AlphaAnimation from code

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

        mFromAlpha = fromAlpha;
        mToAlpha = toAlpha;
    
Methods Summary
protected voidapplyTransformation(float interpolatedTime, Transformation t)
Changes the alpha property of the supplied {@link Transformation}

        final float alpha = mFromAlpha;
        t.setAlpha(alpha + ((mToAlpha - alpha) * interpolatedTime));
    
public booleanhasAlpha()

hide

        return true;
    
public booleanwillChangeBounds()

        return false;
    
public booleanwillChangeTransformationMatrix()

        return false;