我正在尝试在两个具有共享元素(应用程序徽标)的活动之间制作自定义动画。当我同时使用overridePendingTransition
和ActivityOptions.makeSceneTransitionAnimation()
时,挂起的过渡不会被覆盖。当我注释掉该行时,它的工作方式完全符合我的预期
如何使用带有共享元素的自定义动画?
//This doesn't work
val logo = Pair(findViewById<View>(R.id.logo), "logo_small")
startActivity(Intent(this, when (activityToContinueTo) {
1 -> Connect::class.java
2 -> Delivery::class.java
else -> Connect::class.java
}), ActivityOptions.makeSceneTransitionAnimation(this, logo).toBundle())
overridePendingTransition(R.anim.slide_in_right, R.anim.zoom_out)
//This one does!!
val logo = Pair(findViewById<View>(R.id.logo), "logo_small")
startActivity(Intent(this, when (activityToContinueTo) {
1 -> Connect::class.java
2 -> Delivery::class.java
else -> Connect::class.java
}))
overridePendingTransition(R.anim.slide_in_right, R.anim.zoom_out)