我创建了一个坐标数组。图像的中心应该穿过这些坐标。我已经使用 TranslateAnimation 来实现它。但在动画期间,图像在最后两个坐标内移动。下面是我的代码:
private void CreateAnimationAndRun() {
        // move to the different coordinates one by one
        for(int k=0; k<xpoints.length; k++) {
            if(k==0) {
            x1 = xstart;
                y1 = ystart;
            } else {
            x1 = xpoints[k-1];
            y1 = ypoints[k-1];
            }
            x2 = xpoints[k];
            y2 = ypoints[k];
            TranslateAnimation translateAnimation = new TranslateAnimation(x1, x2, y1, y2);
            translateAnimation.setDuration(1000);
            translateAnimation.setAnimationListener(anim_listener);
            imv1.startAnimation(translateAnimation);
        }
    }
上述函数已在单击按钮时被调用。