Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Z-order changed in activity transition animations on android 7.0 (nougat)?

I use custom animations for onBackPressed using

@Override
public void onBackPressed() {
  super.onBackPressed();
  overridePendingTransition(R.anim.zoom_in, R.anim.slide_outto_right);
}

On Android 6.x the exit transition has the highest z-order, which means I can slide the leaving activity out while the "new" activity zooms in below it. Everythings fine on Marshmallow, but on Android 7.0 the z-order has reversed.

Is anybody else experiencing this?

Any fix suggestions?

like image 954
miqueloi Avatar asked Dec 29 '25 07:12

miqueloi


1 Answers

The solution to the problem was to add android:zAdjustment="..." to the anim xml:

<set xmlns:android="http://schemas.android.com/apk/res/android"
     ...
     android:zAdjustment="top">

and

<set xmlns:android="http://schemas.android.com/apk/res/android"
     ...
     android:zAdjustment="bottom">

to the other animation.

Note: I sometime need to rebuild the project to see the anim changes kick through.

like image 56
miqueloi Avatar answered Dec 30 '25 23:12

miqueloi