Custom Animation Object for Transition in Android?

懵懂的女人 提交于 2019-12-12 15:09:23

问题


I want to override the default activity transition in Android with something a bit fancier. What I want to do can't be done with the XML set that one would typically use, so I can't use overridePendingTransition because it only accepts integer references to XML-based animation resources.

What I'd like to do instead is create my own object that inherits from Animation and overrides the getTransformation and applyTransformation methods to do my own thing. This much I can do, but I can't seem to find a way to tie this new animation object into the transition. Is there a method like overridePendingTransition that accepts an Animation object? Or am I going about this all wrong?


回答1:


Currently the job is done by the WindowManagerService, which calls AnimationUtils.loadAnimation. AnimationUtils only loads animation sets from xml resources, so it's not possible to use a customized Animation object.

Hope someone would propose a patch to AOSP that adds support to customized Animation object...



来源:https://stackoverflow.com/questions/4001440/custom-animation-object-for-transition-in-android

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