private void initAnimation() {
AlphaAnimation alphaAnimation = new AlphaAnimation(0.0f,1.0f);//渐变动画
alphaAnimation.setDuration(5000);
alphaAnimation.setFillAfter(true);
RotateAnimation rotateAnimation = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f,
Animation.RELATIVE_TO_SELF, 0.5f);//旋转动画
rotateAnimation.setDuration(5000);
rotateAnimation.setFillAfter(true);
ScaleAnimation scaleAnimation = new ScaleAnimation(0.0f,1.0f, 0.0f, 1.0f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);//比例动画
scaleAnimation.setDuration(5000);
scaleAnimation.setFillAfter(true);
AnimationSet animationSet =new AnimationSet(true);//动画集
animationSet.addAnimation(alphaAnimation);
animationSet.addAnimation(rotateAnimation);
animationSet.addAnimation(scaleAnimation);
rl_splash_root.startAnimation(animationSet);//rl_splash_root是xml布局文件
AnimationSet,AlphaAnimation,RotateAnimation,ScaleAnimation
最新推荐文章于 2021-05-25 17:19:01 发布