<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.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">
<!-- Element constrained to the top of the screen -->
<TextView
android:id="@+id/topTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Top Text"
android:layout_marginTop="16dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
<!-- Element constrained to the bottom of the screen -->
<TextView
android:id="@+id/bottomTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Bottom Text"
android:layout_marginBottom="16dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
<!-- Element centered on the screen -->
<Button
android:id="@+id/centerButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Centered Button"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
<!-- Element positioned relative to another element (below centerButton) -->
<TextView
android:id="@+id/belowCenterTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Below Center"
android:layout_marginTop="16dp"
app:layout_constraintTop_toBottomOf="@id/centerButton"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
<!-- Element positioned to the right of another element -->
<Button
android:id="@+id/rightButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Right Button"
android:layout_marginStart="16dp"
app:layout_constraintTop_toTopOf="@id/centerButton"
app:layout_constraintBottom_toBottomOf="@id/centerButton"
app:layout_constraintStart_toEndOf="@id/centerButton" />
<!-- Element with margin and padding -->
<TextView
android:id="@+id/marginPaddingTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Margin and Padding"