屏幕左侧的 ObjectAnimator 清除将被覆盖的图像

ObjectAnimator from left off screen clears image that will be covered up

下面的 ObjectAnimator 效果很好。

screenWidth = 800;
ObjectAnimator moveOver =
            ObjectAnimator.ofInt(localMovingView, "left", screenWidth, 0)
                    .setDuration(500);
moveOver.start();

但是如果我把screenWidth改成从左边向内移动,效果会很差。当动画开始时,在动画开始之前存在的 View 立即消失。新视图在动画结束时覆盖了空的 space。新旧视图都是被添加到不同ViewGroup的ViewGroup

screenWidth = -800;
ObjectAnimator moveOver =
            ObjectAnimator.ofInt(localMovingView, "left", screenWidth, 0)
                    .setDuration(500);
moveOver.start();

我在 SO 上找不到任何解决此问题的内容,因此我们将不胜感激。我已经检查了消失的视图。它有 mLeft = 0;

动画Views的位置时,最好调整属性translationX和translationY。这些属性不是绝对的,它们是相对于视图当前的 X 和 Y 位置。

编辑:此外,如果视图在继续播放动画之前在其目的地出现片刻,那么我之前的一个问题的答案可能会有用。 FragmentTransaction animation is working but appears glitchy