How to create a transition from an Activity to a Fragment?
I specificly tried to create a MaterialSharedAxis transition from an Activity to a Fragment which did not work for me.
Sample Code:
// Activity A
val fragment = Fragment1()
fragment.enterTransition = MaterialSharedAxis(MaterialSharedAxis.X, true)
fragment.exitTransition = MaterialSharedAxis(MaterialSharedAxis.X, false)
val fragmentManager = supportFragmentManager
.beginTransaction()
.add(R.id.fragment_container_view, Fragment1())
.addToBackStack("fragment")
.commit()
// Fragment B
class Fragment1 : Fragment() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
enterTransition = MaterialSharedAxis(MaterialSharedAxis.X, true)
returnTransition = MaterialSharedAxis(MaterialSharedAxis.X, false)
}
...
}