Custom animation doesnt work on SingleInstance Activity

瘦欲@ 提交于 2019-12-23 03:18:30

问题


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

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.

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.

Cancel ALL Animation on SingleInstance

Android animate to singleTask

Android’s overridePendingTransition and singleInstance


回答1:


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

This is caused by fact, that launchMode singleInstance creates singleton activity in new task.

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.



来源:https://stackoverflow.com/questions/42144203/custom-animation-doesnt-work-on-singleinstance-activity

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!