让新的活动出现的背后旧的过渡期过渡期、让新

2023-09-12 02:44:03 作者:疯子摆摊卖回忆

我试图做到的,是覆盖启动活动的动画。

What I'm trying to achieve is to override the start activity animation.

该动画应得到即时pression旧活动是在新的活动的顶部,然后向下滑动,并在屏幕的以显示新的活动。我试过多种方法,如使用 overridePendingTransition(startAnim,exitAnim) 但问题是,他们都在同一个时间轴动画。因此, overridePendingTransition(R.anim.hold,R.anim.exit_slide_down); 你永远也看不到出口的动画,因为新的活动是在上面。可以这样使用该框架可以实现?

The animation should give the impression that the old activity is on top of the new activity, and then slides down and out of the screen to reveal the new activity. I've tried multiple ways such as using overridePendingTransition(startAnim, exitAnim) But the problem is they both animate in the same timeline. So overridePendingTransition(R.anim.hold, R.anim.exit_slide_down); You never see the exit animation because the new activity is on top. Can this be achieved using the framework?

推荐答案

其实,我发现了一个名为 Android的特性:zAdjustment 中的动画文件。

Actually, I've found a property called android:zAdjustment in the animation files.

如果我把安卓zAdjustment =底部 hold.xml (屏幕2)和机器人:zAdjustment =顶 push_down_out.xml (屏幕1),那么我可以得到想要的效果。

If I put android:zAdjustment="bottom" in hold.xml (screen 2) and android:zAdjustment="top" in push_down_out.xml (screen 1) then I can get the desired effect.

这得到周​​围Z顺序的问题(我认为这是一个问题与动画同步,所以我找错了树)。

This gets around the z order issue (I assumed it was an issue with animation timings so I was barking up the wrong tree).

约翰·