I'm trying to make a transition animation with fragments, which I find strange (or maybe I don’t understand something correctly), is that when using replace
it works as expected, but when using add
it doesn't .. .
WORKS:
EndFragment fragment = new EndFragment(); FragmentManager fragmentManager = getFragmentManager(); fragmentManager.beginTransaction() .addToBackStack(null) .addSharedElement(imageView, imageTransitionName) .addSharedElement(textView, textTransitionName) .replace(R.id.container, fragment) .commit();
DOES NOT WORK:
EndFragment fragment = new EndFragment(); FragmentManager fragmentManager = getFragmentManager(); fragmentManager.beginTransaction() .addToBackStack(null) .addSharedElement(imageView, imageTransitionName) .addSharedElement(textView, textTransitionName) .add(R.id.container, fragment) .commit();
Any ideas?
source share