I would like to have general animations (transitions) between my activities. There are many possibilities. Use TransitionManager, use Activity#overridePendingTransition(), use ActivityOptions, FragmentTransaction#setCusotmAnimation()...
One general solution would be:
<style name="ActivityAnimations" parent="@android:style/Animation.Activity">
<item name="android:activityOpenEnterAnimation">@anim/slide_up_in</item>
<item name="android:activityOpenExitAnimation">@null</item>
<item name="android:activityCloseEnterAnimation">@null</item>
<item name="android:activityCloseExitAnimation">@anim/slide_out_right</item>
</style>
and apply in the base theme:
<item name="android:windowAnimationStyle">@style/ActivityAnimations</item>
int | activityCloseEnterAnimation When closing the current activity, this is the animationthat is run on the next activity (which is entering the screen). |
int | activityCloseExitAnimation When closing the current activity,this is the animation that is run on the current activity (which is exiting the screen). |
int | activityOpenEnterAnimation When opening a new activity,this is the animation that is run on the next activity (which is entering the screen). |
int | activityOpenExitAnimation When opening a new activity,this is the animation that is run on the previous activity (which is exiting the screen). |
<!-- In case we need to generalize for the fragments
<item name="fragmentOpenEnterAnimation">@animator/fragment_open_enter</item>
<item name="fragmentOpenExitAnimation">@animator/fragment_open_exit</item>
<item name="fragmentCloseEnterAnimation">@animator/fragment_close_enter</item>
<item name="fragmentCloseExitAnimation">@animator/fragment_close_exit</item>-->
No comments:
Post a Comment