title: Weird behavior when using ConstraintLayout as the root layout of a DialogFragment
body: <p>I am constructing a custom dialog using a <code>DialogFragment</code>. I've noticed very odd behavior with various ViewGroups used as the root of the dialog's layout. I assume this is due to some strange interaction between the system's windows and how it displays dialogs. In this particular instance, I am using a <code>ConstraintLayout</code> as the root view of the layout.</p>
  
  <p>When displayed, the dialog extends to the edges of the screen, and the Layout Inspector shows a measured width of over 16,000,000. Even weirder is that the <code>ConstraintLayout</code> defines padding, which can still be seen on the screen. </p>
  
  <p>Below is the dialog's class:</p>
  
  <pre><code>public class AgreementDialog extends DialogFragment {
  
      // Bindings..
  
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
  
          View view = inflater.inflate(R.layout.dialog_agreement, container);
          ButterKnife.bind(this, view);
  
          return view;
      }
  }
  </code></pre>
  
  <p>Here is the layout, <code>dialog_agreement</code>:</p>
  
  <pre><code>&lt;android.support.constraint.ConstraintLayout
      xmlns:android="http://schemas.android.com/apk/res/android" 
      xmlns:app="http://schemas.android.com/apk/res-auto"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:background="#fff"
      android:padding="@dimen/margin_large"
      android:layout_margin="@dimen/margin_xlarge"
      &gt;
  
      &lt;CheckBox
          android:id="@+id/checkbox"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          app:layout_constraintStart_toStartOf="parent"
          app:layout_constraintTop_toTopOf="parent"
          /&gt;
  
  
      &lt;TextView
          android:id="@+id/description"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_margin="@dimen/margin_standard"
          android:text="this is some text. "
          app:layout_constraintEnd_toEndOf="parent"
          app:layout_constraintTop_toTopOf="parent"
          app:layout_constraintStart_toEndOf="@id/checkbox"
          /&gt;
  
      &lt;TextView
          android:id="@+id/id"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_margin="@dimen/margin_large"
          android:text="123456789"
          app:layout_constraintBottom_toTopOf="@+id/negative"
          app:layout_constraintTop_toBottomOf="@id/description"
          app:layout_constraintLeft_toLeftOf="parent"
          app:layout_constraintRight_toRightOf="parent"
          /&gt;
  
      &lt;Button
          android:id="@+id/positive"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="@string/confirm"
          app:layout_constraintBottom_toBottomOf="parent"
          app:layout_constraintEnd_toEndOf="parent"
          android:layout_marginEnd="24dp"/&gt;
  
      &lt;Button
          android:id="@+id/negative"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_marginEnd="20dp"
          android:text="@string/cancel"
          app:layout_constraintBaseline_toBaselineOf="@id/positive"
          app:layout_constraintEnd_toStartOf="@id/positive"
          /&gt;
  
  
  &lt;/android.support.constraint.ConstraintLayout&gt;
  </code></pre>
  
  <p>Questions:</p>
  
  <ol>
  <li>Why is the measured width such a large number?</li>
  <li>Given the measured width at over 16,000,000, one would expect the end padding to also be off screen. Why is it visible?</li>
  <li>How can these issues be remedied so that a normal dialog that wraps it's content can be displayed?</li>
  </ol>
  
  <p><strong>EDIT:</strong> I've noticed that removing the padding seems to cause the width to hit that large number. Keeping the padding causes the dialog to maintain a normal margin to the edge of the screen, but clips the content.</p>