I am creating navigation drawer.
When I replace any fragment on it, it does replaces but the frame layout is running in back..
So when I press at empty screen on the fragment, the contents of the main layout are shown. So how can I completely remove the main layout when some fragment replaces it ?
android.support.v4.app.FragmentManager fm=getSupportFragmentManager();
if (id == R.id.nav_categories)
{
Categories cat=new Categories();
FragmentTransaction transaction=fm.beginTransaction().replace(R.id.relative_layout,cat);
transaction.addToBackStack(null);
transaction.commit();
/* fm.beginTransaction().replace(R.id.relative_layout,cat).commit();
Toast.makeText(this,"Categories",Toast.LENGTH_LONG).show();*/
}
else if (id == R.id.nav_rating)
{
Fragment_Rating rat=new Fragment_Rating();
fm.beginTransaction().replace(R.id.relative_layout,rat).commit();
Toast.makeText(this,"Rating",Toast.LENGTH_LONG).show();
FragmentTransaction transaction=fm.beginTransaction().replace(R.id.relative_layout,rat);
transaction.addToBackStack(null);
transaction.commit();
}
I have tried removing addtobackstack...