這些轉變是活動,不爲片段,見below from documentation這些是windowExitTransition指定 & windowEnterTransition
<style name="BaseAppTheme" parent="android:Theme.Material">
<!-- enable window content transitions -->
<item name="android:windowContentTransitions">true</item>
<!-- specify enter and exit transitions -->
<item name="android:windowEnterTransition">@transition/explode</item>
<item name="android:windowExitTransition">@transition/explode</item>
<!-- specify shared element transitions -->
<item name="android:windowSharedElementEnterTransition">
@transition/change_image_transform</item>
<item name="android:windowSharedElementExitTransition">
@transition/change_image_transform</item>
</style>
你可以嘗試實現相同的片段,以及指定的轉變在你的碎片交換。
謝謝,但我知道過渡如何做活動。但是,你能向我展示一個帶有fragmenttransanction的例子嗎? –
它看起來像這樣:fragmentTransaction.setCustomAnimations(R.anim.enter_from_right,R.anim.exit_to_left) – Akhil