自定义动画在SingleInstance Activity上不起作用 [英] Custom animation doesnt work on SingleInstance Activity

查看:460
本文介绍了自定义动画在SingleInstance Activity上不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试更改活动过渡的默认动画,但我遇到了问题。

Im trying to change the default animation of activities transitions, and i stuck with a problem.

我可以更改正常活动的动画,但是当我将launchMode更改为singleInstance时,第一次打开活动时,该动画带有Default。然后,每次我再次调用它时,它都带有正确的自定义动画。

I could change the animation of normal activities, but when i change the launchMode to singleInstance, the first time i open the activity, the animation come with Default. Then, every time i call it again, it come with the right custom animation.

我尝试使用window.attributes.windowAnimations,仅具有样式/主题,并且还覆盖了PendingTransition(),结果始终是相同的。

I tried with window.attributes.windowAnimations, with just style/theme and also overridePendingTransition() and the result is always the same.

我看到有些人遇到同样的问题,但我无法找到一种可行的解决方案。

I saw some people with the same problem, but i coudnt find a solution that work.

在SingleInstance上取消所有动画

Android动画化为singleTask

Android的overridePendingTransition和singleInstance

推荐答案

我遇到了同样的问题。阅读有关任务和后退堆栈的文档后,一切都会变得清楚。

I had the same problem. After reading the documentation about Task and back stack, everything becomes clear.

这是由 launchMode singleInstance 创建新任务中的单个活动

注意,task =具有相同组ID i的一组活动。 e。 亲和力。默认情况下,应用活动具有相同的相似性i。 e。 app由单个任务组成。

Note, task = set of activities with the same group id i. e. affinity. By default app activities have the same affinity i. e. app consists of single task.

通常,过渡动画应用于单个任务中的活动。由于新的任务初始化,第一次转换似乎不起作用。当新任务尚未完全初始化时,未创建此任务的活动,因此您将看到空白屏幕的过渡。

Normally, transition animations are applied on activities within single task. It seems that first transition does not work due of new task initialization. While new task is not fully initialized, activity of this task is not created, thus you will see transition with blank screen.

这篇关于自定义动画在SingleInstance Activity上不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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