title: Margin behavior in ConstraintLayout
body: <p>I am having trouble understanding the behavior of margins (<code>android:layout_margin*</code>) when used in ConstraintLayout. Margins seem to only take effect in certain situations, and I am hoping someone can explain it to me (or confirm that it's a ConstraintLayout bug).</p>
  
  <p>I have the following layout...</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;View
           android:id="@+id/leftView"
           android:layout_width="0dp"
           android:layout_height="100dp"
           android:layout_marginEnd="20dp"
           android:background="@android:color/holo_blue_dark"
           app:layout_constraintEnd_toStartOf="@+id/rightView"
           app:layout_constraintStart_toStartOf="parent"
           app:layout_constraintTop_toTopOf="parent"/&gt;
  
       &lt;View
           android:id="@+id/rightView"
           android:layout_width="100dp"
           android:layout_height="100dp"
           android:background="@android:color/holo_green_light"
           app:layout_constraintEnd_toEndOf="parent"
           app:layout_constraintTop_toTopOf="parent"/&gt;
  
  &lt;/android.support.constraint.ConstraintLayout&gt;
  </code></pre>
  
  <p>... which produces the following output...</p>
  
  <p><a href="https://i.stack.imgur.com/aQaSO.png" rel="noreferrer"><img src="https://i.stack.imgur.com/aQaSO.png" alt="Expected Output"></a></p>
  
  <p>However, when I change the margin from the <code>leftView</code> to the <code>rightView</code>...</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;View
          android:id="@+id/leftView"
          android:layout_width="0dp"
          android:layout_height="100dp"
          android:background="@android:color/holo_blue_dark"
          app:layout_constraintEnd_toStartOf="@+id/rightView"
          app:layout_constraintStart_toStartOf="parent"
          app:layout_constraintTop_toTopOf="parent"/&gt;
  
      &lt;View
          android:id="@+id/rightView"
          android:layout_width="100dp"
          android:layout_height="100dp"
          android:layout_marginStart="20dp"
          android:background="@android:color/holo_green_light"
          app:layout_constraintEnd_toEndOf="parent"
          app:layout_constraintTop_toTopOf="parent"/&gt;
  
  &lt;/android.support.constraint.ConstraintLayout&gt; 
  </code></pre>
  
  <p>... the margin unexpectedly disappears...</p>
  
  <p><a href="https://i.stack.imgur.com/qGQuT.png" rel="noreferrer"><img src="https://i.stack.imgur.com/qGQuT.png" alt="Unexpected Output"></a></p>
  
  <p>Can someone explain whether this is expected behavior and, if so, why that is? </p>