4
votes

I'm inserting Fragments into the Activity using this code:

FragmentTransaction transaction = getFragmentManager().beginTransaction();

MyFragment myFragment = new FMyFragment();
transaction.setCustomAnimations(R.anim.fade_in, R.anim.fade_out);
transaction.replace(R.id.DetailsFragment, myFragment, ForumCreateFragment.FRAG_TAG);
transaction.addToBackStack(null);

transaction.commit();

The custom transition animation is a simple fade in/out animation. It's displaying correctly when I just add this same type of Fragment multiple times.

But when I pop the fragment-backstack with the back button, it flashes in the previous fragment, fades it away, and leaves a blank area, displaying nothing - even if there are more elements on the backstack. It seems that popping the stack causes the transition animations to play backwards. What am I doing wrong?

2

2 Answers

3
votes

This is a known issue.

Unfortunately, the fix did not make it to the 3.1 release, so you will have to deal with it until it gets fixed. Here is the issue report.

3
votes

Adding to mgv's answer above, the most recent ACL fixed it, it is working in my app.

See this comment: http://code.google.com/p/android/issues/detail?id=15623#c19