Skip to content

Instantly share code, notes, and snippets.

@ramonrabello
Last active September 16, 2019 06:02
Show Gist options
  • Save ramonrabello/bf4b75c57310ccc1df4dab8cf800d952 to your computer and use it in GitHub Desktop.
Save ramonrabello/bf4b75c57310ccc1df4dab8cf800d952 to your computer and use it in GitHub Desktop.
activity_main.xml
<?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">
<!-- region Guidelines -->
<androidx.constraintlayout.widget.Guideline
android:id="@+id/startGuideline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_begin="20dp" />
<androidx.constraintlayout.widget.Guideline
android:id="@+id/endGuideline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_end="20dp" />
<androidx.constraintlayout.widget.Guideline
android:id="@+id/topGuideline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.2" />
<androidx.constraintlayout.widget.Guideline
android:id="@+id/bottomGuideline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_end="20dp" />
<!-- endregion -->
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/nameField"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:hint="@string/name_field_hint"
app:layout_constraintEnd_toStartOf="@id/endGuideline"
app:layout_constraintStart_toEndOf="@id/startGuideline"
app:layout_constraintTop_toBottomOf="@id/topGuideline" />
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/surnameField"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:hint="@string/surname_field_hint"
app:layout_constraintBottom_toTopOf="@+id/bindUserButton"
app:layout_constraintEnd_toStartOf="@id/endGuideline"
app:layout_constraintStart_toEndOf="@id/startGuideline"
app:layout_constraintTop_toBottomOf="@id/nameField" />
<Button
android:id="@+id/bindUserButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/bind_user_button"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/endGuideline"
app:layout_constraintStart_toEndOf="@id/startGuideline"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment