title: Android: fragments overlapping issue
body: <p>I am facing a problem of overlapping fragments when i switch between tabs and attach fragments to a tab view
  below is my code please help</p>
  
  <pre><code>public class FragmentManage extends Fragment implements ActionBar.TabListener {
  
      private Fragment mFragment;
  
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container, 
              Bundle savedInstanceState) {
  
          View v = inflater.inflate(R.layout.fragment_manage, container, false);
  
          OnClickListener clickListener = new OnClickListener() { 
              public void onClick(View v) {
                  FragmentTransaction ft = getFragmentManager().beginTransaction();
                  switch(v.getId()) {
                      case R.id.imageBtnCategory:
                          if (mFragment == null){
                              mFragment = new FragmentCategory();
                          }
                          ft.replace(android.R.id.content, mFragment);
                          break;
                      case R.id.imageBtnManageKey:
                          if (mFragment == null){
                              mFragment = new FragmentKeys();
                          }
                          ft.replace(android.R.id.content, mFragment);
                          break;
                      case R.id.imageBtnChangePswd:
                          if (mFragment == null){
                              mFragment = new FragmentChangePwd();
                          }
                          ft.replace(android.R.id.content, mFragment);
                          break;
                  }
                  ft.commit();
               }
          };
  
          ImageButton imageBtnCategory = (ImageButton) v.findViewById(R.id.imageBtnCategory);
          ImageButton imageBtnManageKey = (ImageButton) v.findViewById(R.id.imageBtnManageKey);
          ImageButton imageBtnChangePswd = (ImageButton) v.findViewById(R.id.imageBtnChangePswd);
  
          imageBtnCategory.setOnClickListener(clickListener);
          imageBtnManageKey.setOnClickListener(clickListener);
          imageBtnChangePswd.setOnClickListener(clickListener);
  
          return v;
      }
  
      public void onTabSelected(Tab tab, FragmentTransaction ft) {
          mFragment = new FragmentManage();
          ft.add(android.R.id.content, mFragment);
          ft.attach(mFragment);
      }
  
      public void onTabUnselected(Tab tab, FragmentTransaction ft) {
          ft.remove(mFragment);
      }
  
      public void onTabReselected(Tab tab, FragmentTransaction ft) {
  
      }
  }
  </code></pre>