Java 图像正在恢复到旧位置、翻译、android、xml

Java 图像正在恢复到旧位置、翻译、android、xml,java,android,android-animation,Java,Android,Android Animation,我试图做的是通过以下方式将图像从当前位置设置为新位置的动画 XML 但是,在动画结束时,图像将捕捉回原来的位置。我们如何避免这种情况,以便最终图像将位于新位置。我曾经遇到过类似的问题。我最终使用了动态动画而不是xml: TranslateAnimation anim = new TranslateAnimation(0,0,0,-100); anim.setDuration(2000); anim.setFillAfter(true); logo01.setAnimation(anim); 键

我试图做的是通过以下方式将图像从当前位置设置为新位置的动画

XML
但是,在动画结束时,图像将捕捉回原来的位置。我们如何避免这种情况,以便最终图像将位于新位置。

我曾经遇到过类似的问题。我最终使用了动态动画而不是xml:

TranslateAnimation anim = new TranslateAnimation(0,0,0,-100);
anim.setDuration(2000);
anim.setFillAfter(true);
logo01.setAnimation(anim);
键为anim.setFillAfter(true);
        ImageView   logo01             =    (ImageView) findViewById(R.id.logo01);
        Animation   animation01        =    AnimationUtils.loadAnimation(this, R.anim.translate);
        animation01.reset();
        logo01.clearAnimation();
        logo01.startAnimation(animation01);
TranslateAnimation anim = new TranslateAnimation(0,0,0,-100);
anim.setDuration(2000);
anim.setFillAfter(true);
logo01.setAnimation(anim);