在过渡期间使新活动出现在旧活动后面 [英] Make new activity appear behind old one during transition

查看:33
本文介绍了在过渡期间使新活动出现在旧活动后面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要实现的是覆盖开始活动动画.

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

动画应该给人的印象是旧活动位于新活动之上,然后向下滑动并滑出屏幕以显示新活动.我尝试了多种方法,例如使用 overridePendingTransition(startAnim, exitAnim)但问题是它们都在同一时间轴上制作动画.所以 overridePendingTransition(R.anim.hold, R.anim.exit_slide_down); 你永远不会看到退出动画,因为新的 Activity 位于顶部.使用框架可以实现吗?

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.

如果我将 android:zAdjustment="bottom" 放入 hold.xml(屏幕 2)和 android:zAdjustment="top"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).

约翰

这篇关于在过渡期间使新活动出现在旧活动后面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆