title: FragmentTransaction.remove has no effect
body: <p>My requirement is quite simple: I have a button that should replace a FragmentA by FragmentB.</p>
  
  <p>This sounds easy and nearly work, the big problem is that the old fragment is not removed and the new placed on the front of the old one and they are "living" together in my layout.</p>
  
  <p><img src="https://i.stack.imgur.com/EDRo4.png" alt="enter image description here"></p>
  
  <p><strong>The Code:</strong></p>
  
  <pre><code>FragmentManager fragMgr = a.getSupportFragmentManager();
  Fragment currentFragment = (Fragment) fragMgr.findFragmentById(R.id.fragmentitself);
  
  if(currentFragment!=null){
  
       FragmentTransaction fragTrans = fragMgr.beginTransaction();
       fragTrans.remove(currentFragment);
  
       FragmentB newFragment = new FragmentB();
       fragTrans.replace(R.id.fragmentcontainer, newFragment);
       // I have also tried with R.id.fragmentitself
       fragTrans.addToBackStack(null);
       fragTrans.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
       fragTrans.commit();
  }
  </code></pre>
  
  <p><strong>The Layout:</strong></p>
  
  <pre><code>&lt;FrameLayout
      android:layout_width="0dp"
      android:layout_height="match_parent"
      android:layout_weight="2" 
      android:id="@+id/fragmentcontainer"&gt;
  
      &lt;fragment
          android:id="@+id/fragmentitself"
          android:name="com.WazaBe.MyApp.FragmentA"
          android:layout_width="match_parent"
          android:layout_height="match_parent" /&gt;
  &lt;/FrameLayout&gt;
  </code></pre>