//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))即可
其实就是利用了位移动画实现了抖动的效果.
参考资料:
http://blog.csdn.net/xiaanming/article/details/11066685
Thank you very much
时间: 2024-10-27 07:04:17