I'm trying to align two views one behind the other, centered vertically and horizontally. The size of the views are set dynamically to the size of the screen, this is the XML of the screen:
<?xml version="1.0" encoding="utf-8"?>
<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=".MainActivity">
<ImageView
android:id="@+id/yellow"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="#faff68"
app:layout_constraintHeight_default="percent"
app:layout_constraintHeight_percent="0.6"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintBottom_toBottomOf="@id/purple"
app:layout_constraintLeft_toLeftOf="@id/purple"
app:layout_constraintRight_toRightOf="@id/purple"
app:layout_constraintTop_toTopOf="@id/purple" />
<ImageView
android:id="@+id/purple"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="#c303fa"
app:layout_constraintHeight_default="percent"
app:layout_constraintHeight_percent="0.5"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout>
How can the yellow image be centered behind the purple image using Constraint Layout? (I know how to achieve it in other layouts)