Skip to content

Instantly share code, notes, and snippets.

@mitchtabian
Last active March 24, 2021 19:57
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mitchtabian/6233773419c67307a20bac55ead77a02 to your computer and use it in GitHub Desktop.
Save mitchtabian/6233773419c67307a20bac55ead77a02 to your computer and use it in GitHub Desktop.
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:fillViewport="true"
>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/constraint_layout1"
>
<com.google.android.material.textfield.TextInputLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintBottom_toTopOf="@+id/username_input_layout"
android:padding="16dp"
app:helperText="Email"
android:id="@+id/email_input_layout"
app:layout_constraintVertical_chainStyle="packed"
app:layout_constraintVertical_bias=".1"
>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/email"
android:textColor="#000"
android:hint="@string/your_email"
android:textSize="20sp"
/>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@+id/email_input_layout"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintBottom_toTopOf="@+id/change_password"
android:padding="16dp"
app:helperText="Username"
android:id="@+id/username_input_layout"
>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/username"
android:textColor="#000"
android:hint="@string/your_username"
android:textSize="20sp"
/>
</com.google.android.material.textfield.TextInputLayout>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@+id/username_input_layout"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:textSize="18sp"
android:textColor="@color/link_blue"
android:text="@string/change_password"
android:id="@+id/change_password"
android:gravity="center"
/>
<Button
android:id="@+id/logout_button"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@+id/change_password"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:background="@drawable/red_button_drawable"
android:text="Log out"
android:textAllCaps="false"
android:textColor="#fff"
android:textSize="16sp"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_marginTop="50dp"
android:layout_marginBottom="30dp"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>
@AhmedTawfiqM
Copy link

hello

@mitchtabian
Copy link
Author

Hi

@ryanjanborja
Copy link

Hi, I applied this to one of my activity layout and it works fine but on another layout it's not.

@AxelJurczuk
Copy link

AxelJurczuk commented Sep 1, 2020

Hi! It didn´t work for me until I set android:layout_height="wrap_content" instead of "match parent" (ScrollView)

@cichy1173
Copy link

Hi! It didn´t work for me until I set android:layout_height="wrap_content" instead of "match parent" (ScrollView)

I had the same problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment