要在具有共享元素的两个活动之间进行屏幕转换动画,
您可以阅读
this article并按照上述步骤:
Enable window content transitions in your theme.
Specify a shared elements transition in your style.
Define your transition as an XML resource.
Assign a common name to the shared elements in both layouts with the android:transitionName attribute.
Use the ActivityOptions.makeSceneTransitionAnimation() method.
In combination with ChangeBounds, ChangeImageTransform allows ImageViews that change size, shape, or ImageView.ScaleType to animate contents smoothly.
res / transition / your_transition.xml应该是这样的:
或者只要ivA和ivB需要动画就可以这样做: