我们可以在xml里面设置属性

//设置动画为加速动画(动画播放中越来越快)  android:interpolator="@android:anim/accelerate_interpolator" //设置动画为减速动画(动画播放中越来越慢)  android:interpolator="@android:anim/decelerate_interpolator" //设置动画为先加速在减速(开始速度最快 逐渐减慢)android:interpolator="@android:anim/accelerate_decelerate_interpolator"//先反向执行一段,然后再加速反向回来(相当于我们弹簧,先反向压缩一小段,然后在加速弹出)  android:interpolator="@android:anim/anticipate_interpolator"//同上先反向一段,然后加速反向回来,执行完毕自带回弹效果(更形象的弹簧效果)  android:interpolator="@android:anim/anticipate_overshoot_interpolator" //执行完毕之后会回弹跳跃几段(相当于我们高空掉下一颗皮球,到地面是会跳动几下)android:interpolator="@android:anim/bounce_interpolator"   //循环,动画循环一定次数,值的改变为一正弦函数:Math.sin(2* mCycles* Math.PI* input)  android:interpolator="@android:anim/cycle_interpolator" //线性均匀改变android:interpolator="@android:anim/linear_interpolator"   //加速执行,结束之后回弹 android:interpolator="@android:anim/overshoot_interpolator"

然后我们在代码中也可以设置,顺序效果同上

animation.setInterpolator(new AccelerateInterpolator());  animation.setInterpolator(new DecelerateInterpolator());  animation.setInterpolator(new AccelerateDecelerateInterpolator());  animation.setInterpolator(new AnticipateInterpolator());  animation.setInterpolator(new AnticipateOvershootInterpolator());  animation.setInterpolator(new BounceInterpolator());  animation.setInterpolator(new CycleInterpolator(2));  animation.setInterpolator(new LinearInterpolator());  animation.setInterpolator(new OvershootInterpolator());  

动画不设置Interpolator属性即为默认值,匀速

Interpolator属性也可自定义
转自:https://www.cnblogs.com/onone/articles/6588335.html

更多相关文章

  1. LinearLayout 内部控件居中
  2. GDB + gdbserver 远程调试android native code
  3. Android下实现一个手机监控摄像头
  4. 与屏幕有关的设置:禁止横竖屏切换;横竖屏切换不重启Activity;动态设
  5. Android视音频录制实现步骤(Android学习随笔八)
  6. 一个Demo让你掌握所有的android控件
  7. android之控件EditText学习
  8. [记录]Android虚拟机大屏幕设置
  9. 设置 listview 滚动条样式

随机推荐

  1. TextView 在xml文件中的解释
  2. Android(安卓)TextView文字旋转45°
  3. HOW TO REBUILT THE ANDROID EMULATOR-SP
  4. AndroidStudio 支持Lambda表达式
  5. 【Android】Android(安卓)studio 编译问
  6. Android如何将第三方信息应用设置为默认
  7. Android监听WebView滑动到底部
  8. Android(安卓)webview 调起微信支付
  9. Android往SD卡上存储文件
  10. 【notification】Android(安卓)中创建震