I'm using API Level 21, testing on a Nexus 6.
I have two activities: master + detail, each view has a fragment. When I select an item in the master list it transitions to the detail view.
I have enabled view transitions in both master and detail, like this:
getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS);
Transition ts = new Slide(Gravity.RIGHT);
ts.setDuration(2500);
getWindow().setEnterTransition(ts);
getWindow().setExitTransition(ts);
getWindow().setAllowEnterTransitionOverlap(true);
getWindow().setAllowReturnTransitionOverlap(true);
The transition animations works as expected except for one thing: When I select an item, the parent activity gets hidden as it transitions out, so I can't see it. When I press back, the detail view is transitioned out (not hidden) and the master is transitioned in (not hidden). So why is the master view hidden when it transitions out and the detail view transitions in?
In Android Studio I see several log posts such as this:
changeCanvasOpacity: opaque=true
changeCanvasOpacity: opaque=false
changeCanvasOpacity: opaque=false
changeCanvasOpacity: opaque=false
The first two rows are for the first transition (master => detail) and the second two are back (detail => master). As you can see, only one row is "opaque = true". I believe that is when the master view is hidden (as the transition starts).
How can I prevent this?
In this post Content Transitions In-Depth (part 2), under "Content Transitions Under-The-Hood" and item 1C it says "The framework sets all transitioning views in A to INVISIBLE.".
I believe this is my issue. How can I resolve this?