Android 摇动动画

来源:互联网 发布:重庆天川工程知询公司 编辑:程序博客网 时间:2024/04/28 14:18

1、先创建shake.xml

<?xml version="1.0" encoding="utf-8"?><translate xmlns:android="http://schemas.android.com/apk/res/android"    android:duration="700"    android:fromXDelta="0.0"    android:interpolator="@anim/cycle"    android:toXDelta="15.0" />

2、创建cycle.xml

<?xml version="1.0" encoding="utf-8"?><cycleInterpolator xmlns:android="http://schemas.android.com/apk/res/android"    android:cycles="4.0" />

3、使用方式

Animation animation = AnimationUtils.loadAnimation(this, R.anim.shake);animation.setDuration(1000);animation.setRepeatMode(Animation.INFINITE);iv.startAnimation(animation);
0 0
原创粉丝点击