Pio*_*otr 6 animation android android-animation
我有一个奇怪的问题 - 应该淡出我的控件(ImageButton)的动画不会立即启动.我正在使用fadeout动画来隐藏它,然后在myListener的末尾(onAnimationEnd)我将新资源作为图像放在按钮上.
在我的应用代码中的某处:
Animation a = AnimationUtils.loadAnimation(this,R.anim.fadeout);
a.setAnimationListener(new myListener(location));
buttons[location].setAnimation(a);
a.startNow(); // regardless if its start() or startnNow()
// it will work in most of the cases but not 100% reliable
// I actually can see in debug Log when its late, happens after few more clicks
Run Code Online (Sandbox Code Playgroud)
然后在myListener.onAnimationEnd(动画a)中:
buttons[location].setImageResource(R.drawable.standard_button);
Run Code Online (Sandbox Code Playgroud)
似乎有一个规则,即每个第4或第5个动画都没有开始......
感谢帮助!
Pio*_*otr 11
加入
buttons[location].invalidate();
Run Code Online (Sandbox Code Playgroud)
后
a.startNow();
Run Code Online (Sandbox Code Playgroud)
解决了我的问题.
| 归档时间: |
|
| 查看次数: |
12368 次 |
| 最近记录: |