I have a theme that changes the activity's open/close/enter/exit animations:
<style name="down_up_theme" parent="Theme.rtlfr">
<item name="android:windowAnimationStyle">@style/down_up_animation</item>
</style>
<style name="down_up_animation" parent="@android:style/Animation.Activity">
<item name="android:activityOpenEnterAnimation">@anim/slide_in_top</item>
<item name="android:activityOpenExitAnimation">@anim/hold</item>
<item name="android:activityCloseEnterAnimation">@anim/hold</item>
<item name="android:activityCloseExitAnimation">@anim/slide_out_bottom</item>
</style>
And in the manifest:
<activity android:name=".activity.ArticlesActivity"
android:theme="@style/down_up_theme" />
The goal is to make the activity content slide down on start, and slide up at exit.
The animations work fine on 2.3. On 4.0, though, the exit animation (slide up) doesn't work. What it does animate is the closing of the activities that are spawned from this activity. In my case, I want to animate the closing of the activity with the list of articles, instead the closing of the article detail has the slide up animation.
I guess I could try to add the closing animation to the activity that spawns the one I want to animate, but it actually spawns activities that should have different animations. I also couldn't find any information on this 2.3 vs. 4.0 difference in the documentation.
How can I make my animations work on 4.0?
I'm not sure why the exit animation set in the theme is not working on ICS+, but calling overridePendingTransition()
seems to be working. The simplest way to do this for you is probably to override finish()
in your Activity:
@Override
public void finish() {
super.finish();
overridePendingTransition(R.anim.hold, R.anim.slide_out_bottom);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With