Here\'s the scenario: Activity contains fragment A, which in turn uses getChildFragmentManager() to add fragments A1 and A2
To animate dissapearance of neasted fragments we can force pop back stack on ChildFragmentManager. This will fire transition animation. To do this we need to catch up OnBackButtonPressed event or listen for backstack changes.
Here is example with code.
View.OnClickListener() {//this is from custom button but you can listen for back button pressed
@Override
public void onClick(View v) {
getChildFragmentManager().popBackStack();
//and here we can manage other fragment operations
}
});
Fragment fr = MyNeastedFragment.newInstance(product);
getChildFragmentManager()
.beginTransaction()
.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_CLOSE)
.replace(R.neasted_fragment_container, fr)
.addToBackStack("Neasted Fragment")
.commit();