问题
I'd like to use ActivityOptionsCompat.makeSceneTransitionAnimation to do a scene transition between 2 UI elements but I also need to start multiple activities. This code causes issues (prevents the second activity from even starting). I can start the activities individually to pass the options to the correct activity, but that has its own issues with a flickering UI. Is there another way to accomplish this?
if (targetActivity == TargetActivity.HOMEPAGE) {
baseActivity.startActivity(homeIntent)
} else {
val targetIntent = argumentBuilder.toIntent(baseActivity, targetActivity.clazz)
val intents = arrayOf(homeIntent, targetIntent)
val options = ActivityOptionsCompat.makeSceneTransitionAnimation(baseActivity, view.targetUserImage, "transition_to_inbox")
baseActivity.startActivities(intents, options.toBundle())
}
回答1:
That isn't supported. The framework is designed to transition from one Activity to another within the same task. If you start multiple activities, it has no idea what you intend with respect to UI elements.
来源:https://stackoverflow.com/questions/44770089/android-scene-transition-animation-when-starting-multiple-activities