android 实现左右上下震动的效果
2013-05-23 17:38
183 查看
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" />
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" />
相关文章推荐
- Android ObjectAnimator 无限循环播放,实现上下左右浮动效果
- 布局动画Android ScrollView HorizontalScrollView 实现全方向(上下左右)反弹效果
- Android ScrollView HorizontalScrollView 实现全方向(上下左右)反弹效果
- android之实现上下左右翻页效果
- android 动画(Animation)闪烁、左右摇摆,上下晃动等效果实现
- android之实现上下左右翻页效果
- Android实现左右滑动指引效果
- Android实现左右滑动效果的方法详解
- 剖析Android动画(图片闪烁、左右摇摆、上下晃动等效果)
- android手势滑动——左右滑动效果实现
- Android实现导航菜单左右滑动效果
- Android实现左右滑动的指引效果
- Android中如何使用ViewPager实现类似laucher左右拖动效果
- Android实现渐显按钮的左右滑动效果
- JS实现元素上下左右移动效果
- js实现上下左右弹框划出效果
- Android实现左右滑动效果
- Android实现左右滑动效果
- Android ScrollViewy与HorizontalScrollView实现上下左右滚动
- Android 使用NineOldAndroids实现绚丽的ListView左右滑动删除Item效果