title: Fragment is not covering entire screen
body: <p>please help
  When I run my ListFragment actitivy and click on a fragment (either Buick or Mazda), the layout of the fragment I clicked on is supposed to replace and cover the entire screen but the
  container containing the list of cars stays on the screen and my fragment layout is shown below it. How can I make my fragment's layout replace the entire screen?</p>
  
  <p>I couldn't post my AVD image showing the screen because I don't have enough reputatons to do
  but the screen was showing as below when I clicked on the first item on the list.</p>
  
  <p>Buick
  Mazda</p>
  
  <p>Hello! It's a Buick</p>
  
  <h1>my Mainactivity</h1>
  
  <pre><code>package in.cars.demo;
  
  import android.app.Activity;
  import android.os.Bundle;
  
  public class CarsMainActivity extends Activity {
      /** Called when the activity is first created. */
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.main);
      }
  }
  </code></pre>
  
  <h1>My ListFragment activity</h1>
  
  <pre><code>package in.cars.demo;
  
  import android.app.Fragment;
  import android.app.FragmentTransaction;
  import android.app.ListFragment;
  import android.os.Bundle;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  import android.widget.ArrayAdapter;
  import android.widget.ListAdapter;
  import android.widget.ListView;
  import android.widget.Toast;
  
  public class CarsList extends ListFragment {
  
      String[] cars = new String[] { "Buick", "Mazda" };
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          ListAdapter myListAdapter = new ArrayAdapter&lt;String&gt;(getActivity(), android.R.layout.simple_list_item_1, cars);
          setListAdapter(myListAdapter);
      }
  
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
          return inflater.inflate(R.layout.cars_container, container, false);
      }
  
      @Override
      public void onListItemClick(ListView l, View v, int position, long id) {
          Toast.makeText(getActivity(), getListView().getItemAtPosition(position).toString(), Toast.LENGTH_LONG).show();
          switch (position) {
          case 0:
              Fragment fragment1 = new Fragment1();
              FragmentTransaction transaction1 = getFragmentManager().beginTransaction();
              transaction1.replace(R.id.car_fragment, fragment1);
              transaction1.addToBackStack(null);
              transaction1.commit();
              break;
          case 1:
              Fragment fragment2 = new Fragment2();
              FragmentTransaction transaction2 = getFragmentManager().beginTransaction();
              transaction2.replace(R.id.car_fragment, fragment2);
              transaction2.addToBackStack(null);
              transaction2.commit();
              break;
          }
      }
  }
  </code></pre>
  
  <h1>Fragment1</h1>
  
  <pre><code>package in.cars.demo;
  
  import android.app.Fragment;
  import android.os.Bundle;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  
  public class Fragment1 extends Fragment {
  
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container,
              Bundle savedInstanceState) {
          return inflater.inflate(R.layout.fragment1, container, false);
      }
  }
  </code></pre>
  
  <h1>Fragment2</h1>
  
  <pre><code>package in.cars.demo;
  
  import android.app.Fragment;
  import android.os.Bundle;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  
  public class Fragment2 extends Fragment {
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container,
              Bundle savedInstanceState) {
          return inflater.inflate(R.layout.fragment2, container, false);
      }
  }
  </code></pre>
  
  <h1>main.xml</h1>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:orientation="vertical" &gt;
  
      &lt;fragment 
          android:id="@+id/car_fragment"
          android:name="in.cars.demo.CarsList"
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          /&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <h1>cars_container.xml</h1>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
   &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
           android:orientation="vertical"
           android:layout_width="match_parent"
           android:layout_height="match_parent"
           android:paddingLeft="4dp"
           android:paddingRight="4dp"&gt;
  
       &lt;ListView android:id="@id/android:list"
                 android:layout_width="match_parent"
                 android:layout_height="0dip"
                 android:layout_weight="1"/&gt;
   &lt;/LinearLayout&gt;
  </code></pre>
  
  <h1>fragment1.xml</h1>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:orientation="vertical" &gt;
      &lt;TextView
          android:id="@+id/frag1TV"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:text="Hello! It's a Buick" /&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <h1>fragment2.xml</h1>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:orientation="vertical" &gt;
      &lt;TextView
          android:id="@+id/frag2TV"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:text="Hello! It's a Mazda" /&gt;
  &lt;/LinearLayout&gt;
  </code></pre>