onAnimationEnd虽然animation.hasEnded设置为true,但是当事件被触发时,似乎没有真正完成Android动画.
我希望我的视图可以改变它的背景可绘制的背景ScaleAnimation,但你可以清楚地看到它在完成之前已经改变了几毫秒.问题是,它会闪烁,因为新的背景会出现(=)缩放很短的时间,直到动画完成.
有没有办法获得动画的真实结束,或者只是阻止新背景在这么短的时间内缩放?
谢谢!
//编辑:我正在使用一个AnimationListener来接听以下电话:
@Override
public void onAnimationEnd(Animation animation)
{
View view = (MyView) ((ExtendedScaleAnimation) animation).getView();
view.clearAnimation();
view.requestLayout();
view.refreshBackground(); // <-- this is where the background gets changed
}
Run Code Online (Sandbox Code Playgroud) 我对这种行为感到好奇......我目前正在设置动画XML中的两个值:
android:fillEnabled="true"
android:fillAfter="true"
Run Code Online (Sandbox Code Playgroud)
但是,动画完成后转换不适用...它总是重置.当我通过代码以编程方式设置它似乎工作:
animation.setFillEnabled(true);
animation.setFillAfter(true);
Run Code Online (Sandbox Code Playgroud)
所以我只是好奇它应该如何工作,因为我宁愿在XML上设置它.谢谢!