android 实现左右上下震动的效果
1:在acti里调用代码
Animation shakeAnim = AnimationUtils.loadAnimation(mContext, R.anim.shake_y);
passWd.startAnimation(shakeAnim);
2:在anim目录下的shake_y.xml
<?xml version="1.0" encoding="utf-8"?> <translate xmlns:android="http://schemas.android.com/apk/res/android" android:duration="1000" android:fromYDelta="0" android:interpolator="@anim/cycle" android:toYDelta="10" >
</translate>
3在anim下的cycle.xml文件:
cycles值用来控制摆动的幅度
<?xml version="1.0" encoding="utf-8"?>
<cycleInterpolator xmlns:android="http://schemas.android.com/apk/res/android"
android:cycles="200" />
posted on 2013-05-23 17:38 yujian_bcq 阅读(677) 评论(0) 编辑 收藏 举报