 <p>When you inflate the layout for your fragment, you should ensure that the visibility is set to GONE. The default for a view (and thus your fragment) is VISIBLE.</p> <p>Also, you should use the constants View.VISIBLE and View.GONE instead of 0, 8.</p>