Android中最近使用的动画总结

【Android中最近使用的动画总结】1.缩放动画
2.位移动画(方法以及参数含义)
3.属性动画
4.组合动画

ObjectAnimator scaleX = ObjectAnimator.ofFloat(holder.svGiftImg, "scaleX", 0f,1.3f, 1f); ObjectAnimator scaleY = ObjectAnimator.ofFloat(holder.svGiftImg, "scaleY", 0f, 1.3f, 1f); ObjectAnimator alpha = ObjectAnimator.ofFloat(holder.svGiftImg, "alpha", 1f, 0f); AnimatorSet animatorSet = new AnimatorSet(); //可以设置执行顺序 animatorSet.play(scaleX).with(scaleY).before(alpha); alpha.setStartDelay(600); animatorSet.setDuration(500); alpha.setDuration(200); animatorSet.setInterpolator(new LinearInterpolator()); animatorSet.start();

AnimationSet animationSet = new AnimationSet(true); TranslateAnimation transAnimation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0f,Animation.RELATIVE_TO_SELF,0f, Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, -0.8f); AlphaAnimation alphaAnimation = new AlphaAnimation(1.0f,0f); animationSet.addAnimation(transAnimation); animationSet.addAnimation(alphaAnimation); //animationSet与animatorSet区别是前者可以设置setFillAfteranimationSet.setFillAfter(false); animationSet.setDuration(1000); alphaAnimation.setDuration(700); //使用setStartOffset设置动画执行顺序 alphaAnimation.setStartOffset(500); animationSet.setInterpolator(new LinearInterpolator()); animationSet.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { }@Override public void onAnimationEnd(Animation animation) {holder.tvGetIntegral.setVisibility(View.INVISIBLE); }@Override public void onAnimationRepeat(Animation animation) { } }); view. startAnimation(animationSet);

    推荐阅读