When I tried to use transitions with fragments using similar code from this article on Medium GitHub. It wouldn't work when I am using the add method() on fragment manager but it would work with replace().
FragmentManager fragmentManager = getSupportFragmentManager();
fragmentManager.beginTransaction()
.addSharedElement(mSharedElement, "transName")
.add(D.id.content_frame, fragment, FRAG_NAME)
.addToBackStack(null)
.commit();
I need to use add() method to keep the fragment below as the user will be navigating back and forth between the first fragment which contains a list of items and the second fragment show detailed info about the item. I don't want to keep loading the fragment with the list again.
Is there a way to get shared element transitions to work when using add() on the fragment manager, than replace().