animation Alpha - Android Animation

Android examples for Animation:Alpha Fly Animation

Description

animation Alpha

Demo Code


//package com.java2s;
import android.view.View;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.view.animation.AnimationSet;

import android.view.animation.TranslateAnimation;

public class Main {
    public static void animationAlpha(View paramView) {
        animation(paramView, new AlphaAnimation(0.2F, 1.0F), 1000L, 0L);
    }//w ww  .  ja  v  a  2 s.  co  m

    public static void animationAlpha(View paramView, long paramLong,
            float paramFloat1, float paramFloat2,
            Animation.AnimationListener paramAnimationListener) {
        AlphaAnimation localAlphaAnimation = new AlphaAnimation(
                paramFloat1, paramFloat2);
        localAlphaAnimation.setAnimationListener(paramAnimationListener);
        animation(paramView, localAlphaAnimation, 500L, paramLong);
    }

    private static void animation(View paramView, Animation paramAnimation,
            long paramLong1, long paramLong2) {
        paramAnimation.setDuration(paramLong1);
        paramAnimation.setStartOffset(paramLong2);
        paramView.setVisibility(0);
        paramView.startAnimation(paramAnimation);
    }

    public static void animation(View paramView) {
        TranslateAnimation localTranslateAnimation = new TranslateAnimation(
                2, 1.0F, 2, 0.0F, 2, 0.0F, 2, 0.0F);
        AlphaAnimation localAlphaAnimation = new AlphaAnimation(0.0F, 1.0F);
        AnimationSet localAnimationSet = new AnimationSet(false);
        localAnimationSet.addAnimation(localTranslateAnimation);
        localAnimationSet.addAnimation(localAlphaAnimation);
        animation(paramView, localAnimationSet, 1000L, 0L);
    }
}

Related Tutorials