Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change Activity's default exit animation

For my live wallpaper I want to change the exit animation for the settings activity. By default, when exiting the activity, it simultaniously scales down to the center and fades out. I want it to just fade out, with no resizing involved.

I've tried defining my own animation settings in styles.xml. Setting android:windowExitAnimation to @android:anim/fade_out does not seem to do what I want. The animation still scales down before it is faded out. I've tried countless of other animation settings, such as android:activityCloseExitAnimation, but none of them seem to get rid of the resizing behaviour I explained above.

Also, overridePendingTransition(0, R.anim.abc_fade_out); has the same result: the activity still scales down when exiting.

Is there any way to override this default animation behaviour, so that the exit animation doesn't involve resizing?

If not, is it possible to entirely remove the exit animation, so that the application dissapears instantly?

like image 512
Rudey Avatar asked Apr 15 '14 22:04

Rudey


1 Answers

You should try to override the finish method inside your Activity as follows:

@Override
public void finish() {
    super.finish();
    overridePendingTransition(0, R.anim.abc_fade_out);
}  
like image 74
Blo Avatar answered Sep 30 '22 11:09

Blo