现在的位置: 首页 > 综合 > 正文

android 4.4 TranslateAnimation 替换 ViewPropertyAnimator

2018年04月13日 ⁄ 综合 ⁄ 共 474字 ⁄ 字号 评论关闭

在Android4.4上  使用TranslateAnimation动画位移会有卡顿现象,如果在别的版本中将

android:hardwareAccelerated="false"

设置成这个属性也会有卡顿问题,经过一系列的排查就是这个问题

https://code.google.com/p/android/issues/detail?id=63003

这儿有人提出来了,但是还是没有得到解决!

但是在我师傅发给我的邮件中犀利的解决了!


动画的替换:TranslateAnimation 替换 ViewPropertyAnimator,


http://developer.android.com/reference/android/view/ViewPropertyAnimator.html

使用方法:

animate().translationXBy(x).translationYBy(y).setDuration(400).setInterpolator(new DecelerateInterpolator()).start();

感谢师傅sjq!

分享是一种美德!

抱歉!评论已关闭.