title: Convert LinearLayout to ConstraintLayout issue
body: <p>I am trying to convert a horizontal <code>LinearLayout</code> that has 4 buttons of the same size to a <code>ConstraintLayout</code>.
  The problem is that when I set one or more buttons to <code>android:visibility="gone"</code> in the <code>LinearLayout</code> the remaining buttons are resized to take the entire space (all will be the same size) and in the <code>ConstraintLayout</code> the buttons are removed, but still take the space.</p>
  
  <p><strong>EDIT:</strong> According to the app state, different buttons will be visible.</p>
  
  <p>What do I need to change so the <code>ConstraintLayout</code> will behave like the <code>LinearLayout</code>?</p>
  
  <p><strong>EDIT:</strong> I found a mistake in the ConstraintLayout (constraint references) so I updated it and the images (the problem still exists).</p>
  
  <p><code>LinearLayout</code> xml:</p>
  
  <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="horizontal"&gt;
  
      &lt;Button
          android:id="@+id/b1"
          android:text="B1"
          android:layout_width="0dp"
          android:layout_height="wrap_content"
          android:layout_weight="50"
          /&gt;
  
      &lt;Button
          android:id="@+id/b2"
          android:text="B2"
          android:layout_width="0dp"
          android:layout_height="wrap_content"
          android:layout_weight="50"
          android:visibility="gone"
          /&gt;
  
      &lt;Button
          android:id="@+id/b3"
          android:text="B3"
          android:layout_width="0dp"
          android:layout_height="wrap_content"
          android:layout_weight="50"
          /&gt;
  
      &lt;Button
          android:id="@+id/b4"
          android:text="B4"
          android:layout_width="0dp"
          android:layout_height="wrap_content"
          android:layout_weight="50"
          /&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p><strong>EDIT:</strong> <code>ConstraintLayout</code> xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;android.support.constraint.ConstraintLayout
      xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      android:layout_width="match_parent"
      android:layout_height="match_parent"&gt;
  
      &lt;Button
          android:id="@+id/b1"
          android:text="B1"
          android:layout_width="0px"
          android:layout_height="wrap_content"
          app:layout_constraintLeft_toLeftOf="parent"
          app:layout_constraintRight_toLeftOf="@+id/b2"
          app:layout_constraintTop_toTopOf="parent"
          app:layout_constraintHorizontal_weight="1"
          /&gt;
  
      &lt;Button
          android:id="@+id/b2"
          android:text="B2"
          android:layout_width="0px"
          android:layout_height="wrap_content"
          android:visibility="gone"
          app:layout_constraintLeft_toRightOf="@+id/b1"
          app:layout_constraintRight_toLeftOf="@+id/b3"
          app:layout_constraintTop_toTopOf="parent"
          app:layout_constraintHorizontal_weight="1"
          /&gt;
  
      &lt;Button
          android:id="@+id/b3"
          android:text="B3"
          android:layout_width="0px"
          android:layout_height="wrap_content"
          app:layout_constraintLeft_toRightOf="@+id/b2"
          app:layout_constraintRight_toLeftOf="@+id/b4"
          app:layout_constraintTop_toTopOf="parent"
          app:layout_constraintHorizontal_weight="1"
          android:layout_marginTop="0dp"/&gt;
  
      &lt;Button
          android:id="@+id/b4"
          android:text="B4"
          android:layout_width="0px"
          android:layout_height="wrap_content"
          app:layout_constraintLeft_toRightOf="@+id/b3"
          app:layout_constraintRight_toRightOf="parent"
          app:layout_constraintTop_toTopOf="parent"
          app:layout_constraintHorizontal_weight="1"
          /&gt;
  &lt;/android.support.constraint.ConstraintLayout&gt;
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/feCZT.png" rel="noreferrer"><img src="https://i.stack.imgur.com/feCZT.png" alt="LinearLayout vs ConstraintLayout"></a>
  <a href="https://i.stack.imgur.com/hFTyZ.png" rel="noreferrer"><img src="https://i.stack.imgur.com/hFTyZ.png" alt="ConstraintLayout blueprint"></a></p>