首页 > 其他 > 详细

view抖动效果

时间:2015-03-13 12:16:59      阅读:313      评论:0      收藏:0      [点我收藏+]

1.使用属性动画

  ViewPropertyAnimator.animate(webView).translationX(20).setInterpolator(new CycleInterpolator(4)).setDuration(500).start();

2.使用xml动画---网上搜到的

 1.shake.xml

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

 2.cycle.xml

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

 3.代码实现

  Animation shakeAnim = AnimationUtils.loadAnimation(this, R.anim.shake);
  webView.startAnimation(shakeAnim);

view抖动效果

原文:http://www.cnblogs.com/songsyl1207/p/4334562.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!