title: Android replace fragment still displays some of the replaced fragment
body: <p>I have a tab that contains a linear layout with a searchview and a listview. When the user clicks one of the search results, I want to replace that layout with another layout containing the details of the selection.</p>
  
  <p>What happens when I replace the search fragment only the listview portion of the layout gets replaced; the searchview is still visible and active on the screen.</p>
  
  <p>Here is my search layout:</p>
  
  <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:id="@+id/search_layout"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:orientation="vertical" &gt;
  
      &lt;SearchView
          android:id="@+id/public_calendar_search"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:iconifiedByDefault="false"
      &lt;/SearchView&gt;
  
      &lt;ListView
          xmlns:android="http://schemas.android.com/apk/res/android"
          android:id="@android:id/list"
          android:layout_width="fill_parent"
          android:layout_height="0dp"
          android:layout_weight="1.0"
          android:choiceMode="singleChoice" /&gt;
  
      &lt;TextView
          android:id="@android:id/empty"
          android:layout_width="match_parent"
          android:layout_height="fill_parent"
          android:gravity="center"/&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>Here is the detail layout:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:id="@+id/detail_layout"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:orientation="vertical" &gt;
  
      &lt;LinearLayout
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:baselineAligned="false"
          android:orientation="vertical" &gt;
  
          &lt;Space
              android:layout_width="0dip"
              android:layout_height="20dip"
              android:layout_weight="1" /&gt;
      &lt;/LinearLayout&gt;
  
      &lt;LinearLayout
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:baselineAligned="false"
          android:orientation="horizontal" &gt;
  
          &lt;Space
              android:layout_width="0dp"
              android:layout_height="match_parent"
              android:layout_weight=".1" /&gt;
  
          &lt;TextView
              android:layout_width="0dp"
              android:layout_height="wrap_content"
              android:layout_weight=".8"
              android:text="@string/label_Name" /&gt;
  
          &lt;Space
              android:layout_width="0dp"
              android:layout_height="match_parent"
              android:layout_weight=".1" /&gt;
      &lt;/LinearLayout&gt;
  
      .........
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>And my code to replace the search fragment:</p>
  
  <pre><code>FragmentTransaction transaction = getFragmentManager().beginTransaction();
  
  // Replace whatever is in the fragment_container view with this fragment,
  // and add the transaction to the back stack.
  DetailFragment fragment = DetailFragment.newInstance(cal);
  transaction.replace(R.id.search_layout, fragment);
  
  transaction.addToBackStack(null);
  transaction.commit();
  </code></pre>
  
  <p>Detail fragment creation:</p>
  
  <pre><code>public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
      View v = inflater.inflate(R.layout.detail_layout, container, false);
      return v;
  }
  
  static DetailFragment newInstance(String cal) {
      DetailFragment d = new DetailFragment();
      return d;
  }
  </code></pre>
  
  <p>What am I doing wrong?  How can I get the entire search layout to be replaced.</p>
  
  <p>Thanks!</p>