Using ConstraintLayout with custom Android Dialog : <p>I'm creating a custom Dialog by extending Dialog and using setContentView(). The problem is when I try to show the Dialog it only shows the background shadow instead of my custom layout. I've managed to get the custom layout to show by wrapping it in a RelativeLayout, but I'm wondering if there is a better solution or something I'm doing wrong. Using constraintLayout version 1.0.2. Thanks!</p>

<p>Here is my Custom Dialog:</p>

<pre><code>class EventsFilterDialog(context: Context): Dialog(context) {
    init {
        setContentView(R.layout.dialog_events_filter)
        setCancelable(true)
    }
}
</code></pre>

<p>Here is a simplified version of my R.layout.dialog_events_filter that has the exact same result:</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:background="@color/white"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"&gt;

    &lt;TextView
        android:id="@+id/headerTv"
        android:text="@string/events_filters"
        android:textColor="@color/white"
        android:textSize="18sp"
        android:textStyle="bold"
        android:gravity="center"
        android:background="@color/colorPrimaryLight"
        android:padding="16dp"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent" /&gt;

    &lt;View
        android:id="@+id/middleView"
        android:layout_width="0dp"
        android:layout_height="256dp"
        app:layout_constraintTop_toBottomOf="@+id/headerTv"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent" /&gt;

    &lt;TextView
        android:id="@+id/closeTv"
        android:text="@string/close"
        android:textColor="@color/white"
        android:textAllCaps="true"
        android:textStyle="bold"
        android:gravity="center"
        android:background="@color/colorPrimaryLight"
        android:layout_width="0dp"
        android:layout_height="48dp"
        app:layout_constraintTop_toBottomOf="@+id/middleView"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toLeftOf="@+id/applyTv" /&gt;

    &lt;TextView
        android:id="@+id/applyTv"
        android:text="@string/apply_filter"
        android:textColor="@color/white"
        android:textAllCaps="true"
        android:textStyle="bold"
        android:gravity="center"
        android:background="@color/colorAccent"
        android:layout_width="0dp"
        android:layout_height="48dp"
        app:layout_constraintTop_toBottomOf="@+id/middleView"
        app:layout_constraintLeft_toRightOf="@+id/closeTv"
        app:layout_constraintRight_toRightOf="parent"/&gt;

&lt;/android.support.constraint.ConstraintLayout&gt;
</code></pre>
