属性动画在某些机器不按逻辑执行
2016-12-19 11:27
225 查看
属性动画不按逻辑执行,比如直接执行结束
public void start() {
anim = null;
if (anim == null) {
anim = ObjectAnimator.ofInt(ia, "start", 0, 360);
}
anim.setInterpolator(new LinearInterpolator());
anim.setDuration(MAX_DURATION); // 1 minute
anim.addUpdateListener(this);
// anim.addListener(this);
long duration = anim.getDuration();
System.out.println(duration);
anim.start();
}
该代码片段执行逻辑是0 到 360递增,但是在某些手机上直接执行到360,显然这是不能原谅的.
---
网上一顿找,
http://blog.csdn.net/luojiusan520/article/details/51207597
发现按这个设置,属性动画照样不好使.
突然间想到以前遇到的问题,
我想要虚线,可以用shape表示,结果不显示
一顿找
添加如下属性即可 android:layerType="software"
我想问题就应该是它了,结果我试了一下,问题解决,动画按要求执行
修改后的代码片段:
public void start() {
anim = null;
if (anim == null) {
anim = ObjectAnimator.ofInt(ia, "start", 0, 360);
}
anim.setInterpolator(new LinearInterpolator());
anim.setDuration(MAX_DURATION); // 1 minute
anim.addUpdateListener(this);
// anim.addListener(this);
long duration = anim.getDuration();
setLayerType(LAYER_TYPE_SOFTWARE, paint); //搞定了哈哈哈哈
anim.start();
}
....
又遇到问题,设置以上代码在联想手机上也不行,我靠,无语了.真解决不了~
public void start() {
anim = null;
if (anim == null) {
anim = ObjectAnimator.ofInt(ia, "start", 0, 360);
}
anim.setInterpolator(new LinearInterpolator());
anim.setDuration(MAX_DURATION); // 1 minute
anim.addUpdateListener(this);
// anim.addListener(this);
long duration = anim.getDuration();
System.out.println(duration);
anim.start();
}
该代码片段执行逻辑是0 到 360递增,但是在某些手机上直接执行到360,显然这是不能原谅的.
---
网上一顿找,
http://blog.csdn.net/luojiusan520/article/details/51207597
发现按这个设置,属性动画照样不好使.
突然间想到以前遇到的问题,
我想要虚线,可以用shape表示,结果不显示
一顿找
添加如下属性即可 android:layerType="software"
我想问题就应该是它了,结果我试了一下,问题解决,动画按要求执行
修改后的代码片段:
public void start() {
anim = null;
if (anim == null) {
anim = ObjectAnimator.ofInt(ia, "start", 0, 360);
}
anim.setInterpolator(new LinearInterpolator());
anim.setDuration(MAX_DURATION); // 1 minute
anim.addUpdateListener(this);
// anim.addListener(this);
long duration = anim.getDuration();
setLayerType(LAYER_TYPE_SOFTWARE, paint); //搞定了哈哈哈哈
anim.start();
}
....
又遇到问题,设置以上代码在联想手机上也不行,我靠,无语了.真解决不了~
相关文章推荐
- 王学岗属性动画上(八)--不适用动画监听,动画先后执行
- android使用属性动画执行抖动效果
- 王学岗的属性动画上(三)-------多个动画同时执行
- WPF 动画执行后属性无法修改
- 某些只执行一次的初始化逻辑
- 属性动画(Property Animation)执行过程
- CSS3的 transform属性,怎么才能让他同时执行多个不同动画(属性)效果
- propertyanimator(属性动画)之valuesanimator(动画执行类)
- 属性动画(property animation) &重复执行
- CSS3的 transform属性,怎么才能让他同时执行多个不同动画(属性)效果
- WPF实现在电脑重启或关机时执行某些逻辑
- 属性动画设置延迟后,如果在未开始前取消,会执行onAnimationStart方法,特此记录
- propertyAnimator(属性动画)之objectanimator(动画执行类)
- 王学岗的属性动画上(六)——监听动画的执行
- 问题: alerview的按钮点击时,某些view动画不会执行
- 属性动画设置addListener后onAnimationStart不执行
- 应用程序运行时,动画的执行与代码的逻辑顺序不匹配,即指定控件未出现动画效果,而其他控件却出现动画效果
- 多个属性动画同时执行的方法
- WPF学习心得(1):WPF进行动画后不能改变相对应的属性问题的解决
- 关于使用wse3.0客户机程序在某些机器上连接服务端奇慢的问题