左右摇摆的原理,就是向一个方向移动,然后设置反方向的属性。再设置重复次数。
TranslateAnimation animation = new TranslateAnimation(0, -5, 0, 0);
animation.setInterpolator(new OvershootInterpolator());
animation.setDuration(100);
animation.setRepeatCount(3);
animation.setRepeatMode(Animation.REVERSE);
login_layout.startAnimation(animation);对于这个login_layout,他是个view.就行。
本文介绍了一种使用TranslateAnimation实现视图摇摆动画的方法。通过设置动画参数,如移动距离、重复次数及模式等,使视图实现左右摇摆的效果。此技术适用于Android应用开发中增加动态元素。
738

被折叠的 条评论
为什么被折叠?



