title: match_parent not working xml android
body: <p>I'm trying to make buttons wich would change part of the context, but the match_parent not working propertly.</p>
  
  <p>got java main file:</p>
  
  <pre><code>class public MainActivity extends ActionBarActivity {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
          getSupportActionBar().setDisplayShowHomeEnabled(true);
          getSupportActionBar().setIcon(R.drawable.ic_launcher);
  
          Button bn1 = (Button) findViewById(R.id.navbar_1);
          Button bn2 = (Button) findViewById(R.id.navbar_2);
  
          bn1.setOnClickListener(new OnClickListener() {
              @Override
              public void onClick(View v) {
                  FragmentMeters fr = new FragmentMeters();
                  FragmentManager fm = getFragmentManager();
                  FragmentTransaction ft = fm.beginTransaction();
                  ft.replace(R.id.layout_to_replace, fr);
                  ft.commit();
  
              }
          });
  
          bn2.setOnClickListener(new OnClickListener() {
              @Override
              public void onClick(View v) {
                  FragmentValues fr = new FragmentValues();
                  FragmentManager fm = getFragmentManager();
                  FragmentTransaction ft = fm.beginTransaction();
                  ft.replace(R.id.layout_to_replace, fr);
                  ft.commit();
  
  
  
              }
          });
      }
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
          getMenuInflater().inflate(R.menu.menu_main, menu);
          return true;
      }
  
  }
  </code></pre>
  
  <p>Then another java class FragmentMeters (and similar FragmentValues):</p>
  
  <pre><code>public class FragmentMeters extends Fragment {
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
  
          View view = inflater.inflate(R.layout.fragment_meters, null);
  
          return view;
      }
  
  }
  </code></pre>
  
  <p>And main XML, something like this:</p>
  
  <pre><code>&lt;LinearLayout
      android:id="@+id/navbar"
      android:orientation="horizontal"
      android:layout_width="fill_parent"
      android:layout_height="82dp"
      android:background="@color/highlighted_text_material_dark"
      android:weightSum="4"&gt;
  
      &lt;Button
          android:id="@+id/navbar_1"
          android:text="@string/navbar_1"
          android:layout_width="0dp"
          android:layout_height="match_parent"
          android:layout_weight="1"
          android:textSize="13sp"
          android:background="@android:color/transparent"
          android:gravity="bottom|center_horizontal" /&gt;
      &lt;Button
          android:id="@+id/navbar_2"
          android:text="@string/navbar_2"
          android:layout_width="0dp"
          android:layout_height="match_parent"
          android:layout_weight="1"
          android:textSize="13sp"
          android:background="@android:color/transparent"
          android:gravity="bottom|center_horizontal" /&gt;
  &lt;/LinearLayout&gt;
  
  &lt;LinearLayout
      android:id="@+id/layout_to_replace"
      android:orientation="horizontal"
      android:layout_below="@+id/navbar"
      android:layout_width="match_parent"
      android:background="@color/dim_foreground_disabled_material_dark"
      android:layout_height="82dp"
      android:weightSum="4"/&gt;
  </code></pre>
  
  <p>And I'm trying to replace the LinearLayout (id="layout_to_replace") with this fragment_meters.xml:</p>
  
  <pre><code> &lt;LinearLayout
          xmlns:android="http://schemas.android.com/apk/res/android"
          android:orientation="horizontal"
          android:layout_below="@+id/navbar"
          android:layout_width="match_parent"
          android:layout_height="82dp"
          android:background="@color/dim_foreground_disabled_material_dark"
          android:weightSum="4"&gt;
  
          &lt;TextView
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:text="METERS"/&gt;
  
      &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>But I'm getting this:</p>
  
  <p><img src="https://i.stack.imgur.com/HVZkE.png" alt="enter image description here"></p>
  
  <p>Instead of matching it parent's width/height. </p>