码迷,mamicode.com
首页 > 其他好文 > 详细

view抖动效果

时间:2015-03-13 12:18:07      阅读:117      评论: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
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!