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

泪湿孤枕 提交于 2019-12-24 00:59:08

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!