如果启动器规定了输入活动动画,如何覆盖它 [英] How to override the enter activity animation if it is stated by launcher
问题描述
我尝试进行 Google 搜索,但我只找到了使用 overridePendingTransition() 方法的活动内动画解决方案.但是,如果我想在我的应用程序通过启动器启动时拥有自己的动画,有什么解决方案吗?
I tried to do Google search but I only found the solution for intra-activity animation using overridePendingTransition() method. However, is there any solution if I would like to have my own animation when my application is started by launcher?
非常感谢!
推荐答案
您可以使用自定义主题定义动画.这是您基本需要的.假设您知道如何使用主题,如果不知道,那就是一个单独的问题.下面只需删除您不想为其定义自己的动画的任何行,它将回退到默认的 android 动画.
You can define your animation with a custom theme. Here is what you basically need. Assuming you know how to use a theme, if not that is a separate question. Below just delete any line you don't want to define your own animation for and it will fall back to the default android animation.
<!-- this goes in your theme -->
<item name="android:windowAnimationStyle">@style/MyActivityAnimations</item>
<!-- Standard animations for a full-screen window or activity. -->
<style name="MyActivityAnimations" parent="@android:style/Animation.Activity">
<item name="activityOpenEnterAnimation">@anim/activity_open_enter</item>
<item name="activityOpenExitAnimation">@anim/activity_open_exit</item>
<item name="activityCloseEnterAnimation">@anim/activity_close_enter</item>
<item name="activityCloseExitAnimation">@anim/activity_close_exit</item>
<item name="taskOpenEnterAnimation">@anim/task_open_enter</item>
<item name="taskOpenExitAnimation">@anim/task_open_exit</item>
<item name="taskCloseEnterAnimation">@anim/task_close_enter</item>
<item name="taskCloseExitAnimation">@anim/task_close_exit</item>
<item name="taskToFrontEnterAnimation">@anim/task_open_enter</item>
<item name="taskToFrontExitAnimation">@anim/task_open_exit</item>
<item name="taskToBackEnterAnimation">@anim/task_close_enter</item>
<item name="taskToBackExitAnimation">@anim/task_close_exit</item>
<item name="wallpaperOpenEnterAnimation">@anim/wallpaper_open_enter</item>
<item name="wallpaperOpenExitAnimation">@anim/wallpaper_open_exit</item>
<item name="wallpaperCloseEnterAnimation">@anim/wallpaper_close_enter</item>
<item name="wallpaperCloseExitAnimation">@anim/wallpaper_close_exit</item>
<item name="wallpaperIntraOpenEnterAnimation">@anim/wallpaper_intra_open_enter</item>
<item name="wallpaperIntraOpenExitAnimation">@anim/wallpaper_intra_open_exit</item>
<item name="wallpaperIntraCloseEnterAnimation">@anim/wallpaper_intra_close_enter</item>
<item name="wallpaperIntraCloseExitAnimation">@anim/wallpaper_intra_close_exit</item>
</style>
这篇关于如果启动器规定了输入活动动画,如何覆盖它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!