title: ConstraintLayout draws outside DialogFragment boundaries
body: <p>I want to create a dialog with round corners using ConstraintLayout, DialogFragment and a custom background.</p>
  
  <p>The dialog must have a scroll area at the top and a custom button at the bottom. The dialog should resize in height based on the size of the scroll view.
  I tried on Android 6 and Android 9 but the issue with the above combination is present on both platforms.</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"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:fitsSystemWindows="true"
      android:paddingStart="12dp"
      android:paddingTop="8dp"
      android:paddingEnd="12dp"
      android:paddingBottom="8dp"
      app:layout_constrainedHeight="true"&gt;
  
      &lt;ImageView
          android:id="@+id/iv_icon"
          android:layout_width="32dp"
          android:layout_height="32dp"
          android:contentDescription="@null"
          android:scaleType="fitXY"
          android:src="@drawable/animated_vector_cross"
          app:layout_constraintBottom_toTopOf="@+id/tv_title"
          app:layout_constraintEnd_toEndOf="parent"
          app:layout_constraintHorizontal_bias="0.5"
          app:layout_constraintStart_toStartOf="parent"
          app:layout_constraintTop_toTopOf="parent" /&gt;
  
      &lt;TextView
          android:id="@+id/tv_title"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_marginTop="8dp"
          android:paddingStart="8dp"
          android:paddingEnd="8dp"
          android:text="@string/info"
          android:textColor="@color/sweet_dialog_bg_color_dark"
          android:textSize="@dimen/fs_XXLarge_Land"
          android:textStyle="bold"
          app:layout_constraintBottom_toTopOf="@+id/scrollView5"
          app:layout_constraintEnd_toEndOf="parent"
          app:layout_constraintHorizontal_bias="0.5"
          app:layout_constraintStart_toStartOf="parent"
          app:layout_constraintTop_toBottomOf="@+id/iv_icon" /&gt;
  
      &lt;TextView
          android:id="@+id/bt_ok"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_marginStart="4dp"
          android:layout_marginEnd="8dp"
          android:background="@drawable/dialog_accept_bt_ripple"
          android:clickable="true"
          android:focusable="true"
          android:paddingStart="8dp"
          android:paddingTop="0dp"
          android:paddingEnd="8dp"
          android:paddingBottom="0dp"
          android:text="@string/dialog_ok"
          app:layout_constraintBottom_toBottomOf="parent"
          app:layout_constraintEnd_toEndOf="parent"
          app:layout_constraintHorizontal_bias="0.5"
          app:layout_constraintStart_toStartOf="@+id/guideline3"
          app:layout_constraintTop_toBottomOf="@+id/scrollView5"
          tools:ignore="ContentDescription" /&gt;
  
      &lt;ScrollView
          android:id="@+id/scrollView5"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:layout_marginTop="8dp"
          android:layout_marginBottom="8dp"
          android:fillViewport="false"
          android:orientation="vertical"
          app:layout_constrainedHeight="true"
          app:layout_constraintBottom_toTopOf="@+id/bt_ok"
          app:layout_constraintEnd_toEndOf="parent"
          app:layout_constraintHorizontal_bias="0.5"
          app:layout_constraintStart_toStartOf="parent"
          app:layout_constraintTop_toBottomOf="@+id/tv_title"&gt;
  
          &lt;TextView
              android:id="@+id/tv_message"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:text="@string/lorem_ipsum"
              android:textSize="@dimen/fs_XLarge_Land" /&gt;
      &lt;/ScrollView&gt;
  
      &lt;android.support.constraint.Guideline
          android:id="@+id/guideline3"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:orientation="vertical"
          app:layout_constraintGuide_percent="0.5" /&gt; &lt;/android.support.constraint.ConstraintLayout&gt;
  </code></pre>
  
  <p>The problem is that if the text that I put inside the scroll view is big the bottom button will be pushed outside of the dialog.</p>
  
  <p><a href="https://i.stack.imgur.com/Z9s4F.png" rel="nofollow noreferrer">With little text the dialog shrinks but the bottom button is correctly displayed.</a></p>
  
  <p><a href="https://i.stack.imgur.com/AsNPE.png" rel="nofollow noreferrer">With big text the button is pushed outside.</a></p>
  
  <p>What settings do I miss?</p>