问题
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?
回答1:
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.
来源:https://stackoverflow.com/questions/39574898/z-order-changed-in-activity-transition-animations-on-android-7-0-nougat