安卓(Android) 怎么从scaleanimation、alphaanimation获取新动画集(AnimationSet)

2019年10月15日21:39:21安卓(Android) 怎么从scaleanimation、alphaanimation获取新动画集(AnimationSet)已关闭评论 210 632字阅读2分6秒

1.简介

安卓(Android) 怎么从scaleanimation、alphaanimation获取新动画集(AnimationSet)?——请看下文。

2.示例代码

/**
 * 版权所有 编程十万个怎么办(www.tah1986.com)
 */


import android.view.animation.*;

public class Main {
    public static AnimationSet getNewAnimationSet() {
        AnimationSet animationset = new AnimationSet(true);
        ScaleAnimation scaleanimation = new ScaleAnimation(1.0F, 1.8F,
                1.0F, 1.8F, 1, 0.5F, 1, 0.5F);
        scaleanimation.setDuration(900L);
        scaleanimation.setRepeatCount(-1);
        AlphaAnimation alphaanimation = new AlphaAnimation(1.0F, 0.1F);
        alphaanimation.setRepeatCount(-1);
        animationset.setDuration(900L);
        animationset.addAnimation(scaleanimation);
        animationset.addAnimation(alphaanimation);
        return animationset;
    }
}