title: Align Button in a ConstraintLayout
body: <p>I designed a simple registration screen like below.</p>
  
  <p><a href="https://i.stack.imgur.com/ZC7aS.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZC7aS.png" alt="image1"></a></p>
  
  <p>And here is the xml code for it.</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="match_parent"
  android:layout_height="match_parent"
  tools:context=".RegisterActivity"&gt;
  
  &lt;android.support.design.widget.TextInputLayout
      android:id="@+id/textInputLayout2"
      android:layout_width="368dp"
      android:layout_height="wrap_content"
      android:layout_marginStart="8dp"
      android:layout_marginTop="8dp"
      app:layout_constraintStart_toStartOf="parent"
      app:layout_constraintTop_toTopOf="parent"&gt;
  
      &lt;android.support.design.widget.TextInputEditText
          android:id="@+id/reg_display_name"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:hint="hint"
          android:text="Display name" /&gt;
  &lt;/android.support.design.widget.TextInputLayout&gt;
  
  &lt;android.support.design.widget.TextInputLayout
      android:id="@+id/textInputLayout3"
      android:layout_width="368dp"
      android:layout_height="wrap_content"
      android:layout_marginStart="8dp"
      android:layout_marginTop="8dp"
      app:layout_constraintStart_toStartOf="parent"
      app:layout_constraintTop_toBottomOf="@+id/textInputLayout2"&gt;
  
      &lt;android.support.design.widget.TextInputEditText
          android:id="@+id/reg_email"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:hint="hint"
          android:text="Email" /&gt;
  &lt;/android.support.design.widget.TextInputLayout&gt;
  
  &lt;android.support.design.widget.TextInputLayout
      android:id="@+id/textInputLayout4"
      android:layout_width="368dp"
      android:layout_height="wrap_content"
      android:layout_marginStart="8dp"
      android:layout_marginTop="8dp"
      app:layout_constraintStart_toStartOf="parent"
      app:layout_constraintTop_toBottomOf="@+id/textInputLayout3"&gt;
  
      &lt;android.support.design.widget.TextInputEditText
          android:id="@+id/reg_password"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:hint="hint"
          android:text="Password" /&gt;
  &lt;/android.support.design.widget.TextInputLayout&gt;
  
  &lt;Button
      android:id="@+id/reg_create_btn"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_marginTop="64dp"
      android:text="Create account"
      android:textAllCaps="false"
      app:layout_constraintTop_toBottomOf="@+id/textInputLayout4"
      tools:layout_editor_absoluteX="132dp" /&gt;
  </code></pre>
  
  <p></p>
  
  <p>However, when I run the app the button is not aligned in the center. </p>
  
  <p><a href="https://i.stack.imgur.com/AS7Od.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/AS7Od.png" alt="image2"></a></p>
  
  <p>Any ideas how to fix that?</p>
  
  <p>Thanks,
  Theo.</p>