Open MHKalantarian opened 5 years ago
i know it's too late but maybe this be useful, so just add this to fragmentA(which list is there):
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
postponeEnterTransition()
val parentView = view.parent as ViewGroup
parentView.viewTreeObserver
.addOnPreDrawListener(object : ViewTreeObserver.OnPreDrawListener {
override fun onPreDraw(): Boolean {
parentView.viewTreeObserver.removeOnPreDrawListener(this)
startPostponedEnterTransition()
return true
}
})
super.onViewCreated(view, savedInstanceState)
}
I have nested fragments inside a fragment and it works perfect when I enter the second fragment. But when I pop back stack to return to the first fragment it just normally returns without any animation or move or anything, like no shared elements ever defined. Also I'm using cardview for my recycler items layout.