I have two fragments - A and B - both fragments take up the entire screen. When I load my activity I show the user fragment A while in the background I load fragment B (in the fragmentmanager I do replace on fragment A and then on fragment B I do add and hide). Both fragments have relatively similar layouts (or at least it would be fair to say that the layout of A just before the transition is similar to the starting layout of B - views move around) and when I want to move from A to B I do a "show" on B and "hide" on A. It almost works perfectly, but you can still see a short flash of white in between, before B is shown, and it ruins the illusion that both are the same fragment. How can I transition without the user noticing?
A couple of words of explanation as to why there are two fragments and not one - the business logic is separate. Each fragment deals with a different part of the flow and it wouldn't make any sense to combine them.
Things I've tried so far:
• as I said above, I tried adding B in the background and only doing a "show" on it when it's needed - to save any setup time
• I tried overriding the pending transition and putting a fadeout/fadein, but it made no difference
• I tried hiding fragmentA instead of removing it when showing fragmentB, but it made no difference
• I tried overriding pending transition with 0,0 (getting rid of transitions entirely) but it's still the same
Code:
getSupportFragmentManager().beginTransaction()
.replace(R.id.contentBlock, fragmentA, "FRAGMENTA")
.add(R.id.contentBlock, fragmentB)
.hide(fragmentB)
.commit();
and later:
getSupportFragmentManager().beginTransaction()
.show(fragmentB)
.remove(fragmentA)
.commit();