IMHO I do not agree with this answer.
You may want to replace your fragment or you may want to add it.
For example let’s say that you are in a fragment that is a list retrieved by a network request, if you replace the fragment with let’s say the detailFragment and you add it to backStack.
When you go back your fragment will redo the network query, of course you can cache it but why? It is a back to a previous state, so with add the last fragment will be in exactly the same status with no code whatsoever.
Fragments are transparent backgrounded by default because they can be used to paint only a small portion of the screen but if your fragment is match_parent then just set its background to a color and keep using add on the fragmentTransaction.
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/scrollView1"
android:background="@android:color/white"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
That will be your root element on the fragment layout XML, could be linear, etc etc
and the transaction code is:
YourFragment detail = YourFragment.newInstance(Id);
ft.add(R.id.contentHolder, detail);
ft.addToBackStack(TAG);
ft.commit();
Hope this helps someone that wants to know how to see a solid background without changing the add to replace which is usually not the best case.
Regards