我有一个奇怪的问题 - 不时应淡出我的控制动画(ImageButton的)不会立即一命呜呼我使用的是淡出动画来隐藏它,然后在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

然后,在myListener.onAnimationEnd(动画A):

buttons[location].setImageResource(R.drawable.standard_button);

似乎有一个规则,即每4个或5动画无法启动......

感谢您的帮助!

有帮助吗?

解决方案

添加

buttons[location].invalidate(); 

a.startNow();

有固定我的问题。

其他提示

您还可以使用

buttons[location].startAnimation(a);
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top