Android examples for Animation:Animation Creation
Add Animation to AnimationSet
//package com.java2s; import android.view.animation.AlphaAnimation; import android.view.animation.Animation; import android.view.animation.AnimationSet; public class Main { private static AnimationSet showAction; private static AnimationSet hideAction; private static void initAnimation() { Animation animation = new AlphaAnimation(0.0f, 1.0f); animation.setDuration(500);//w w w .jav a2 s . c o m showAction = new AnimationSet(false); showAction.addAnimation(animation); animation = new AlphaAnimation(1.0f, 0.2f); animation.setDuration(2000); hideAction = new AnimationSet(false); hideAction.addAnimation(animation); } }