Android抖动动画

jopen 6年前

//CycleTimes动画重复的次数   public Animation shakeAnimation(int CycleTimes) {    Animation translateAnimation = new TranslateAnimation(0, 10, 0, 10);    translateAnimation.setInterpolator(new CycleInterpolator(CycleTimes));    translateAnimation.setDuration(1000);    return translateAnimation;   }
然后调用view.setAnimation(shakeAnimation(5))即可

其实就是利用了位移动画实现了抖动的效果.