title: Adding a close button to a DialogFragment
body: <p>I've been trying to make a DialogFragment have a close button in the top left, as seen in the photo. <a href="https://i.stack.imgur.com/rPnGX.png" rel="nofollow noreferrer">What the final result should look like (Sorry about the text, it's in romanian)</a> Could anyone tell me how I could go about doing that? </p>
  
  <p>Here's the layout for the fragment:</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"
  android:layout_width="match_parent"
  android:layout_height="match_parent"&gt;
  
  &lt;LinearLayout
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_marginRight="5dp"
      android:layout_marginTop="10dp"
      android:background="#FFFFFF"
      android:gravity="center"
      android:orientation="vertical"
      android:paddingBottom="-50dp" &gt;
      &lt;TextView
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="Sample Text"/&gt;
      &lt;!---add your views here--&gt;
  &lt;/LinearLayout&gt;
  
  &lt;ImageView
      android:id="@+id/imageView_close"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      app:layout_constraintTop_toTopOf="parent"
      app:layout_constraintLeft_toLeftOf="parent"
      android:clickable="true"
      android:src="@drawable/ic_close_dialog" /&gt;
  </code></pre>
  
  <p></p>
  
  <p>The way the fragment looks now: <a href="https://i.stack.imgur.com/ZhqjD.png" rel="nofollow noreferrer">A small box where the image and text are overlayed</a></p>