I made a theme with a custom animation (slide up and slide down). The animation works fine on the older android versions.. However, when I try it out on Android 4.0 (ICS) the on close animation doesn't work. Only the slide up animation works fine on ICS.
Here is my theme I use for the animation:
<style name="myTheme" parent="android:Theme.Black">
<item name="android:windowTitleSize">45dip</item>
<item name="android:windowTitleBackgroundStyle">@style/CustomWindowTitleBackground</item>
<item name="android:windowAnimationStyle">@style/myTheme.Window</item>
</style>
<style name="myTheme.Window" parent="@android:style/Animation.Activity">
<item name="android:activityOpenEnterAnimation">@anim/push_up_in_no_alpha</item>
<item name="android:activityOpenExitAnimation">@anim/no_anim</item>
<item name="android:activityCloseEnterAnimation">@anim/no_anim</item>
<item name="android:activityCloseExitAnimation">@anim/push_down_out_no_alpha</item>
</style>
And here is push_down_out_no_alpha.xml:
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate android:fromYDelta="0" android:toYDelta="100%p"
android:duration="@android:integer/config_longAnimTime"/>
</set>
When i set a animation in code it also works fine on ICS, but why not as a theme?
this.overridePendingTransition(R.anim.no_anim,R.anim.push_down_out_no_alpha);
Does anyone know why it isn't working on Android 4.0 (ICS)?
I have also tried but its not working here. Don't know what is the problem but
this.overridePendingTransition(R.anim.no_anim,R.anim.push_down_out_no_alpha);
this code is working fineSpecifying animations from the manifest appears to be broken in ICS :-( The override animation solution works fine, but you probably don't want to hard-code the animations. It would be nice to get them from the manifest as you would for other versions of the platform.. so....
add a couple of member fields to your activity to hold the ids of the animations attached to your activity..
and somewhere in your onCreate...
then wherever your activity finishes/should apply animation include...
and your activities should correctly honour the animations you set in the theme/style attached to activities in your manifest.