1

我有一系列动画,我像这样串联调用:

final Animation anim1 = AnimationUtils.loadAnimation(thisObject, R.anim.animation1);
final Animation anim2 = AnimationUtils.loadAnimation(thisObject, R.anim.animation2);
final Animation anim3 = AnimationUtils.loadAnimation(thisObject, R.anim.animation3);
final Animation anim4 = AnimationUtils.loadAnimation(thisObject, R.anim.animation4);

anim1.setAnimationListener(new AnimationListener() 
{                   
    public void onAnimationStart(Animation animation) { }                   
    public void onAnimationRepeat(Animation animation) { }

    public void onAnimationEnd(Animation animation) 
    {
        image.startAnimation(anim2);                        
    }
});

anim2.setAnimationListener(new AnimationListener() 
{                   
    public void onAnimationStart(Animation animation) { }                   
    public void onAnimationRepeat(Animation animation) { }

    public void onAnimationEnd(Animation animation) 
    {
        image.startAnimation(anim3);                        
    }
});

// etc...

view.startAnimation(anim1);

虽然这有效,但图像会在每个动画之间瞬间恢复到其原始位置。我已经在我所有的动画 XML 文件中定义android:fillAftertrue,但这似乎并没有改变任何东西。有没有办法防止动画之间的这种快照?或者有没有更好的方法来达到同样的效果?

4

0 回答 0