Change default exit animation

For my live wallpapers, I want to change the output animation for the activity settings. By default, when exiting an operation, it is simultaneously scaled to the center and disappears. I want it to just fade, without resizing.

I tried to define my own animation settings in styles.xml. Installing android:windowExitAnimationin @android:anim/fade_outdoes not seem to do what I want. The animation is still scaled before it disappears. I tried many other animation settings, such as android:activityCloseExitAnimation, but none of them seem to get rid of the resizing behavior that I explained above.

In addition, it overridePendingTransition(0, R.anim.abc_fade_out);has the same result: activity still decreases upon exit.

Is there a way to override this default behavior so that the exit animation does not require resizing?

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

+4
source share
1 answer

You should try to override the method finishinside Activityas follows:

@Override
public void finish() {
    super.finish();
    overridePendingTransition(0, R.anim.abc_fade_out);
}  
+11
source

Source: https://habr.com/ru/post/1536686/


All Articles