Q:

Fragments overlap after transaction

I made the LauncherActivity of the app a NavigationDrawer Activity.  Then i made two test Fragments : "VibBearFragment" and "FragmentTwo"
I used this code in onNavigationItemSelected() to switch between Fragments.  And i included the "VibBearFragment" in the contents of the drawer so that it is there when the app starts.  
 Fragment fragment = new FragmentTwo();
    switch (item.getItemId()) {
        case R.id.nav_teddy_vib:
            fragment = new VibBearFragment();
            break;
        case R.id.nav_fragment1:
            break;
        case R.id.vibActivity:
            Intent i = new Intent(this, MainActivity.class);
            startActivity(i);
            break;
        case R.id.nav_call_me:
            Intent callIntent = new Intent(Intent. ACTION_DIAL);
            callIntent.setData(Uri.parse("tel:0123456789"));
            startActivity(callIntent);

            break;
        default:
            fragment = new FragmentTwo();
            break;
    }
    FragmentManager fragmentManager = getSupportFragmentManager();
    fragmentManager.beginTransaction().replace(R.id.vibFragment, fragment).commit();

But the "VibBearFragment" just covers up "FragmentTwo" and they overlap. And all the buttons work when the Fragments are overlapping. The interesting part is that if I click "FragmentTwo" they overlap , but if I click "VibBearFragment" even if "FragmentTwo" was open it works properly . 
This is the XML for the Fragment that gets replaced grammatically
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/RelativeLayoutSwap"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="com.example.slaven.teddybear. Drawer"
tools:showIn="@layout/app_bar_drawer">

<fragment
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:name="com.example.slaven.teddybear. Fragments. VibBearFragment"
    android:id="@+id/vibFragment"
    android:layout_centerVertical="true"
    android:layout_centerHorizontal="true"
    tools:layout="@layout/vib_bear_fragment" />

I did my best to try and show you the problem.  Also Button N2 (from the picture)
dissapears when activities overlap but still works. Can anyone please help ? 

A:

You can't do transactions with static fragment(the ones defined in the xml layout).  If you do plan to do transactions then manually add them. 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/RelativeLayoutSwap"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="com.example.slaven.teddybear. Drawer"
tools:showIn="@layout/app_bar_drawer">

   <FrameLayout android:id="@+id/content"
      android:layout_width="match_parent"   
      android:layout_height="match_parent"   />

</RelativeLayout>

Then in your activities onCreate() method add the fragment from the layout:
//...onCreate()  
Fragment content = getSupportFragmentManager().findFragmentById(R.id.content);
if (savedInstance == null || content == null) {
    // add the initial fragment from the layout
    content = new VibBearFragment();
    getSupportFragmentmanager().beginTransaction().replace(R.id.content, content).commit();
}

