Center the ConstraintLayout in the screen - android

I'm trying to vertically center a ConstraintLayout in the screen. The ConstraintLayout is the root element of the entire layout of the LoginActivity.
I set the android:layout_gravity to center (as in the code below). It does the job in the Android Studio Design Editor, but when I run the app on the phone the ConstraintLayout is aligned to the top of the screen.
How can I effectively center the ConstraintLayout in the screen? Thanks.
<?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="wrap_content"
android:layout_gravity="center"
tools:context=".activities.LoginActivity">
<ImageView
android:id="#+id/ivLogo"
android:layout_width="wrap_content"
android:layout_height="100dp"
android:layout_marginTop="50dp"
android:contentDescription="#string/cutitapp_logo"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="#drawable/ic_cutitapp_logo"
tools:srcCompat="#drawable/ic_cutitapp_logo" />
<com.google.android.material.textfield.TextInputLayout
android:id="#+id/tilEmail"
style="#style/CutitApp.TextInputLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginTop="52dp"
android:layout_marginEnd="24dp"
app:endIconMode="clear_text"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#id/ivLogo">
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/etEmail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:autofillHints=""
android:hint="#string/email"
android:inputType="textEmailAddress"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
tools:ignore="TextContrastCheck" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="#+id/tilPassword"
style="#style/CutitApp.TextInputLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="24dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#id/tilEmail"
app:passwordToggleEnabled="true">
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/etPassword"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:autofillHints=""
android:hint="#string/password"
android:inputType="textPassword"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#id/etEmail"
tools:ignore="TextContrastCheck" />
</com.google.android.material.textfield.TextInputLayout>
<TextView
android:id="#+id/tvError"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="40dp"
android:layout_marginTop="16dp"
android:textColor="?attr/colorError"
android:textSize="12sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/tilPassword" />
<Button
android:id="#+id/btnLogin"
style="#style/CutitApp.Button"
android:layout_width="0dp"
android:layout_marginStart="24dp"
android:layout_marginTop="24dp"
android:layout_marginEnd="24dp"
android:text="#string/login"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/tvError" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginEnd="24dp"
android:gravity="center"
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/btnLogin">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/not_a_member" />
<Button
android:id="#+id/btnRegister"
style="#style/Widget.AppCompat.Button.Borderless"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/register"
android:textAllCaps="false"
android:textColor="#color/design_default_color_primary"
android:textSize="14sp" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

Here you go.
I just added an extra ConstraintLayout
<?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="wrap_content"
android:layout_gravity="center">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent">
<ImageView
android:id="#+id/ivLogo"
android:layout_width="wrap_content"
android:layout_height="100dp"
android:layout_marginTop="50dp"
android:contentDescription="#string/cutitapp_logo"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="#drawable/ic_cutitapp_logo"
tools:srcCompat="#drawable/ic_cutitapp_logo" />
<com.google.android.material.textfield.TextInputLayout
android:id="#+id/tilEmail"
style="#style/CutitApp.TextInputLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginTop="52dp"
android:layout_marginEnd="24dp"
app:endIconMode="clear_text"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#id/ivLogo">
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/etEmail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:autofillHints=""
android:hint="#string/email"
android:inputType="textEmailAddress"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
tools:ignore="TextContrastCheck" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="#+id/tilPassword"
style="#style/CutitApp.TextInputLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="24dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#id/tilEmail"
app:passwordToggleEnabled="true">
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/etPassword"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:autofillHints=""
android:hint="#string/password"
android:inputType="textPassword"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#id/etEmail"
tools:ignore="TextContrastCheck" />
</com.google.android.material.textfield.TextInputLayout>
<TextView
android:id="#+id/tvError"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="40dp"
android:layout_marginTop="16dp"
android:textColor="?attr/colorError"
android:textSize="12sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/tilPassword" />
<Button
android:id="#+id/btnLogin"
style="#style/CutitApp.Button"
android:layout_width="0dp"
android:layout_marginStart="24dp"
android:layout_marginTop="24dp"
android:layout_marginEnd="24dp"
android:text="#string/login"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/tvError" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginEnd="24dp"
android:gravity="center"
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/btnLogin">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/not_a_member" />
<Button
android:id="#+id/btnRegister"
style="#style/Widget.AppCompat.Button.Borderless"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/register"
android:textAllCaps="false"
android:textColor="#color/design_default_color_primary"
android:textSize="14sp" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

Related

why constrainlayout not showing exactly as real device

I am developing new app but my preview window showing different and real device different I did not understand what is the problem
below my current layout
<?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"
android:background="#451C80">
<TextView
android:id="#+id/getStarted"
style="#style/password"
android:layout_width="178dp"
android:layout_height="wrap_content"
android:layout_marginTop="60dp"
android:layout_marginEnd="148dp"
android:gravity="center"
android:text="#string/password"
android:textAppearance="#style/password"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="#+id/imageView3"
android:layout_width="34dp"
android:layout_height="0dp"
android:layout_marginStart="8dp"
android:layout_marginTop="48dp"
android:layout_marginEnd="11dp"
android:src="#drawable/ic_back"
app:layout_constraintEnd_toStartOf="#+id/getStarted"
app:layout_constraintHorizontal_bias="0.4"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="#+id/textView"
style="#style/password"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="55dp"
android:layout_marginTop="138dp"
android:layout_marginEnd="220dp"
android:layout_marginBottom="32dp"
android:text="#string/set_password"
android:textSize="16sp"
app:layout_constraintTop_toBottomOf="#id/textInputLayout"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="#+id/textView3"
style="#style/password"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="28dp"
android:text="Confirm Password"
android:textSize="16sp"
app:layout_constraintBottom_toTopOf="#+id/textInputLayout2"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.167"
app:layout_constraintStart_toStartOf="parent" />
<com.google.android.material.textfield.TextInputLayout
android:id="#+id/textInputLayout"
android:layout_width="318dp"
android:layout_height="44dp"
android:layout_marginTop="192dp"
app:endIconMode="password_toggle"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/editText3"
android:layout_width="318dp"
android:layout_height="44dp"
android:background="#drawable/username_edittext"
android:inputType="textPassword"
tools:ignore="TouchTargetSizeCheck" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="#+id/textInputLayout2"
android:layout_width="318dp"
android:layout_height="44dp"
android:layout_marginBottom="506dp"
app:endIconMode="password_toggle"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.494"
app:layout_constraintStart_toStartOf="parent">
<com.google.android.material.textfield.TextInputEditText
android:layout_width="316dp"
android:layout_height="47dp"
android:layout_marginStart="1dp"
android:background="#drawable/username_edittext"
android:inputType="textPassword" />
</com.google.android.material.textfield.TextInputLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
current screen from preview window in android studio
screenshot from real device
I want to know exactly where I am making mistake what I am making wrong what I have to do in order to implement correctly constrainlayout
You have not given constraints properly.
Don't use this property layout_constraintHorizontal_bias to arrange views, understandlayout_constraintTop_toTopOf,layout_constraintTop_toBottomOf,layout_constraintBottom_toTopOf and layout_constraintBottom_toBottomOf property to arrange views vertically.
You can also use LinearLayout if UI is quite simple and If you use ConstraintLayout you have to give proper constraints so that ui will not look different in device as well as in preview
I have modified your code so please check below code for now so replace below code in your xml file.
<?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"
android:background="#451C80">
<TextView
android:id="#+id/getStarted"
style="#style/password"
android:layout_width="178dp"
android:layout_height="wrap_content"
android:layout_marginTop="60dp"
android:layout_marginEnd="148dp"
android:gravity="center"
android:text="#string/password"
android:textAppearance="#style/password"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="#+id/imageView3"
android:layout_width="34dp"
android:layout_height="0dp"
android:layout_marginStart="8dp"
android:layout_marginTop="48dp"
android:layout_marginEnd="11dp"
android:src="#drawable/ic_back"
app:layout_constraintEnd_toStartOf="#+id/getStarted"
app:layout_constraintHorizontal_bias="0.4"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="#+id/textView"
style="#style/password"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="138dp"
android:layout_marginEnd="220dp"
android:layout_marginBottom="32dp"
android:text="#string/set_password"
android:textSize="16sp"
app:layout_constraintTop_toBottomOf="#id/textInputLayout"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="#+id/textView3"
style="#style/password"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="28dp"
android:text="Confirm Password"
android:textSize="16sp"
android:layout_marginTop="20dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="#id/textInputLayout"
app:layout_constraintStart_toStartOf="#id/textView" />
<com.google.android.material.textfield.TextInputLayout
android:id="#+id/textInputLayout"
android:layout_width="318dp"
android:layout_height="44dp"
android:layout_marginTop="20dp"
app:endIconMode="password_toggle"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#id/textView">
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/editText3"
android:layout_width="318dp"
android:layout_height="44dp"
android:background="#drawable/username_edittext"
android:inputType="textPassword"
tools:ignore="TouchTargetSizeCheck" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="#+id/textInputLayout2"
android:layout_width="318dp"
android:layout_height="44dp"
android:layout_marginTop="20dp"
android:layout_marginBottom="506dp"
app:endIconMode="password_toggle"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="#id/textView3"
app:layout_constraintStart_toStartOf="parent">
<com.google.android.material.textfield.TextInputEditText
android:layout_width="316dp"
android:layout_height="47dp"
android:layout_marginStart="1dp"
android:background="#drawable/username_edittext"
android:inputType="textPassword" />
</com.google.android.material.textfield.TextInputLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

Why does the height of my Constraintlayout increase when I place it in a Scrollview?

I have a ConstraintLayout which shows all items on my smartphone without the need to scroll. Nevertheless I want to surround the ConstraintLayout with a ScrollView that a user with smaller phones can scroll.
When adding the ScrollView, even on my smartphone I need to scroll to reach the last to buttons. The height of the ConstraintLayout increases and the two buttons with id="#+id/button3" and id="#+id/button4" appear after a big empty area.
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
>
<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:id="#+id/linearLayout3"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<Button
android:id="#+id/button3"
android:layout_width="150dp"
android:layout_height="50dp"
android:layout_marginStart="10dp"
android:layout_marginBottom="16dp"
android:drawableLeft="#drawable/ic_chevron_left_black_24dp"
android:onClick="zurueckZuMainActivity"
android:text="Zurück"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<Button
android:id="#+id/button4"
android:layout_width="150dp"
android:layout_height="50dp"
android:layout_marginEnd="10dp"
android:layout_marginBottom="16dp"
android:drawableRight="#drawable/ic_chevron_right_black_24dp"
android:onClick="weiter"
android:text="Weiter"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
<TextView
android:id="#+id/textView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:text="Bestellformular"
android:textAppearance="#style/TextAppearance.AppCompat.Large"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="#+id/textView7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="10dp"
android:text="Schritt 1/4: Lieferadresse"
android:textAppearance="#style/TextAppearance.AppCompat.Medium"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/textView6" />
<ImageView
android:id="#+id/imageView9"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="10dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="10dp"
app:layout_constraintBottom_toBottomOf="#+id/textInputLayout_vorname"
app:layout_constraintEnd_toStartOf="#+id/textInputLayout_vorname"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="#+id/textInputLayout_vorname"
app:layout_constraintVertical_bias="0.523"
app:srcCompat="#drawable/ic_person_black_24dp" />
<com.google.android.material.textfield.TextInputLayout
android:id="#+id/textInputLayout_vorname"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:layout_marginEnd="10dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="#+id/imageView9"
app:layout_constraintTop_toBottomOf="#+id/textView7"
>
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/vorname_edit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Vorname"
android:inputType="textCapWords"
/>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="#+id/textInputLayout_nachname"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="9dp"
android:layout_marginEnd="10dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="#+id/textInputLayout_vorname"
app:layout_constraintTop_toBottomOf="#+id/textInputLayout_vorname">
<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Nachname"
android:inputType="textCapWords"
android:id="#+id/nachname_edit"
/>
</com.google.android.material.textfield.TextInputLayout>
<ImageView
android:id="#+id/imageView11"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:layout_marginBottom="20dp"
app:layout_constraintBottom_toTopOf="#+id/textInputLayout_strasse"
app:layout_constraintEnd_toStartOf="#+id/textInputLayout_telefonnummer"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/imageView9"
app:layout_constraintVertical_bias="0.587"
app:srcCompat="#drawable/ic_phone_black_24dp" />
<com.google.android.material.textfield.TextInputLayout
android:id="#+id/textInputLayout_telefonnummer"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="36dp"
android:layout_marginEnd="10dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="#+id/imageView11"
app:layout_constraintTop_toBottomOf="#+id/textInputLayout_nachname">
<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Telefonnummer"
android:id="#+id/telefonnummer_edit"
android:inputType="number"
/>
</com.google.android.material.textfield.TextInputLayout>
<ImageView
android:id="#+id/imageView12"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="10dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="10dp"
android:layout_marginBottom="4dp"
app:layout_constraintBottom_toBottomOf="#+id/textInputLayout_email"
app:layout_constraintEnd_toStartOf="#+id/textInputLayout_email"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/textInputLayout_telefonnummer"
app:layout_constraintVertical_bias="1.0"
app:srcCompat="#drawable/ic_email_black_24dp" />
<com.google.android.material.textfield.TextInputLayout
android:id="#+id/textInputLayout_email"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginEnd="10dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="#+id/imageView12"
app:layout_constraintTop_toBottomOf="#+id/textInputLayout_telefonnummer">
<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="E-Mail-Adresse"
android:id="#+id/email_edit"
/>
</com.google.android.material.textfield.TextInputLayout>
<ImageView
android:id="#+id/imageView13"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="10dp"
android:layout_marginTop="300dp"
android:layout_marginEnd="10dp"
android:layout_marginBottom="248dp"
app:layout_constraintBottom_toTopOf="#+id/button3"
app:layout_constraintEnd_toStartOf="#+id/textInputLayout_strasse"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/textInputLayout_vorname"
app:layout_constraintVertical_bias="0.361"
app:srcCompat="#drawable/ic_location_on_black_24dp" />
<com.google.android.material.textfield.TextInputLayout
android:id="#+id/textInputLayout_strasse"
android:layout_width="0dp"
android:layout_height="53dp"
android:layout_marginTop="36dp"
android:layout_marginEnd="7dp"
android:layout_marginBottom="23dp"
app:layout_constraintBottom_toTopOf="#+id/textInputLayout_stadt"
app:layout_constraintEnd_toStartOf="#+id/textInputLayout_nummer"
app:layout_constraintStart_toEndOf="#+id/imageView13"
app:layout_constraintTop_toBottomOf="#+id/textInputLayout_email"
app:layout_constraintVertical_bias="0.13">
<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Straße"
android:inputType="textCapWords"
android:id="#+id/strasse_edit"
/>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="#+id/textInputLayout_nummer"
android:layout_width="152dp"
android:layout_height="53dp"
android:layout_marginTop="34dp"
android:layout_marginEnd="10dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="#+id/textInputLayout_strasse"
app:layout_constraintTop_toBottomOf="#+id/textInputLayout_email">
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/nummer_edit"
android:layout_width="163dp"
android:layout_height="wrap_content"
android:hint="Nummer"
/>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="#+id/textInputLayout_plz"
android:layout_width="108dp"
android:layout_height="56dp"
android:layout_marginStart="55dp"
android:layout_marginTop="7dp"
android:layout_marginEnd="12dp"
app:layout_constraintEnd_toStartOf="#+id/textInputLayout_stadt"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/textInputLayout_strasse">
<com.google.android.material.textfield.TextInputEditText
android:layout_width="106dp"
android:layout_height="44dp"
android:hint="PLZ"
android:id="#+id/plz_edit"
android:inputType="number"
/>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="#+id/textInputLayout_stadt"
android:layout_width="0dp"
android:layout_height="56dp"
android:layout_marginTop="7dp"
android:layout_marginEnd="10dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="#+id/textInputLayout_plz"
app:layout_constraintTop_toBottomOf="#+id/textInputLayout_nummer"
app:layout_constraintVertical_bias="0.0">
<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Stadt"
android:id="#+id/stadt_edit"
android:inputType="textCapWords"
/>
</com.google.android.material.textfield.TextInputLayout>
<TextView
android:id="#+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="1dp"
android:text="Füllen Sie bitte alle nachfolgenden Felder aus! "
app:layout_constraintBottom_toTopOf="#+id/textInputLayout_vorname"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/textView7" />
</androidx.constraintlayout.widget.ConstraintLayout>
How can I solve this?
yu have used fillviewport="true" which basically increases the height of your scroll view to use remaining space if there is extra space available in viewport. If you will make it false, the height of the viewport will be as you expected.
Try wrapping your Buttons in their own ConstraintLayout, inside linearLayout3
<androidx.constraintlayout.widget.ConstraintLayout
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_width="match_parent"
android:layout_height="0dp">
<Button
android:id="#+id/button4"
android:layout_width="150dp"
android:layout_height="50dp"
android:layout_marginEnd="10dp"
android:layout_marginBottom="16dp"
android:onClick="weiter"
android:text="Weiter"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
<Button
android:id="#+id/button3"
android:layout_width="150dp"
android:layout_height="50dp"
android:layout_marginStart="10dp"
android:layout_marginBottom="16dp"
android:onClick="zurueckZuMainActivity"
android:text="Zurück"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
You could try to add a RelativeLayout:
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/linearLayout3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="#+id/textView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:text="Bestellformular"
android:textAppearance="#style/TextAppearance.AppCompat.Large"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="#+id/textView7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="10dp"
android:text="Schritt 1/4: Lieferadresse"
android:textAppearance="#style/TextAppearance.AppCompat.Medium"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/textView6" />
<ImageView
android:id="#+id/imageView9"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="10dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="10dp"
app:layout_constraintBottom_toBottomOf="#+id/textInputLayout_vorname"
app:layout_constraintEnd_toStartOf="#+id/textInputLayout_vorname"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="#+id/textInputLayout_vorname"
app:layout_constraintVertical_bias="0.523"
/>
<com.google.android.material.textfield.TextInputLayout
android:id="#+id/textInputLayout_vorname"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:layout_marginEnd="10dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="#+id/imageView9"
app:layout_constraintTop_toBottomOf="#+id/textView7"
>
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/vorname_edit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Vorname"
android:inputType="textCapWords"
/>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="#+id/textInputLayout_nachname"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="9dp"
android:layout_marginEnd="10dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="#+id/textInputLayout_vorname"
app:layout_constraintTop_toBottomOf="#+id/textInputLayout_vorname">
<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Nachname"
android:inputType="textCapWords"
android:id="#+id/nachname_edit"
/>
</com.google.android.material.textfield.TextInputLayout>
<ImageView
android:id="#+id/imageView11"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:layout_marginBottom="20dp"
app:layout_constraintBottom_toTopOf="#+id/textInputLayout_strasse"
app:layout_constraintEnd_toStartOf="#+id/textInputLayout_telefonnummer"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/imageView9"
app:layout_constraintVertical_bias="0.587"
/>
<com.google.android.material.textfield.TextInputLayout
android:id="#+id/textInputLayout_telefonnummer"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="36dp"
android:layout_marginEnd="10dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="#+id/imageView11"
app:layout_constraintTop_toBottomOf="#+id/textInputLayout_nachname">
<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Telefonnummer"
android:id="#+id/telefonnummer_edit"
android:inputType="number"
/>
</com.google.android.material.textfield.TextInputLayout>
<ImageView
android:id="#+id/imageView12"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="10dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="10dp"
android:layout_marginBottom="4dp"
app:layout_constraintBottom_toBottomOf="#+id/textInputLayout_email"
app:layout_constraintEnd_toStartOf="#+id/textInputLayout_email"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/textInputLayout_telefonnummer"
app:layout_constraintVertical_bias="1.0"
/>
<com.google.android.material.textfield.TextInputLayout
android:id="#+id/textInputLayout_email"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginEnd="10dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="#+id/imageView12"
app:layout_constraintTop_toBottomOf="#+id/textInputLayout_telefonnummer">
<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="E-Mail-Adresse"
android:id="#+id/email_edit"
/>
</com.google.android.material.textfield.TextInputLayout>
<ImageView
android:id="#+id/imageView13"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="10dp"
android:layout_marginTop="300dp"
android:layout_marginEnd="10dp"
android:layout_marginBottom="248dp"
app:layout_constraintBottom_toTopOf="#+id/button3"
app:layout_constraintEnd_toStartOf="#+id/textInputLayout_strasse"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/textInputLayout_vorname"
app:layout_constraintVertical_bias="0.361"
/>
<com.google.android.material.textfield.TextInputLayout
android:id="#+id/textInputLayout_strasse"
android:layout_width="0dp"
android:layout_height="53dp"
android:layout_marginTop="36dp"
android:layout_marginEnd="7dp"
android:layout_marginBottom="23dp"
app:layout_constraintBottom_toTopOf="#+id/textInputLayout_stadt"
app:layout_constraintEnd_toStartOf="#+id/textInputLayout_nummer"
app:layout_constraintStart_toEndOf="#+id/imageView13"
app:layout_constraintTop_toBottomOf="#+id/textInputLayout_email"
app:layout_constraintVertical_bias="0.13">
<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Straße"
android:inputType="textCapWords"
android:id="#+id/strasse_edit"
/>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="#+id/textInputLayout_nummer"
android:layout_width="152dp"
android:layout_height="53dp"
android:layout_marginTop="34dp"
android:layout_marginEnd="10dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="#+id/textInputLayout_strasse"
app:layout_constraintTop_toBottomOf="#+id/textInputLayout_email">
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/nummer_edit"
android:layout_width="163dp"
android:layout_height="wrap_content"
android:hint="Nummer"
/>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="#+id/textInputLayout_plz"
android:layout_width="108dp"
android:layout_height="56dp"
android:layout_marginStart="55dp"
android:layout_marginTop="7dp"
android:layout_marginEnd="12dp"
app:layout_constraintEnd_toStartOf="#+id/textInputLayout_stadt"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/textInputLayout_strasse">
<com.google.android.material.textfield.TextInputEditText
android:layout_width="106dp"
android:layout_height="44dp"
android:hint="PLZ"
android:id="#+id/plz_edit"
android:inputType="number"
/>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="#+id/textInputLayout_stadt"
android:layout_width="0dp"
android:layout_height="56dp"
android:layout_marginTop="7dp"
android:layout_marginEnd="10dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="#+id/textInputLayout_plz"
app:layout_constraintTop_toBottomOf="#+id/textInputLayout_nummer"
app:layout_constraintVertical_bias="0.0">
<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Stadt"
android:id="#+id/stadt_edit"
android:inputType="textCapWords"
/>
</com.google.android.material.textfield.TextInputLayout>
<TextView
android:id="#+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="1dp"
android:text="Füllen Sie bitte alle nachfolgenden Felder aus! "
app:layout_constraintBottom_toTopOf="#+id/textInputLayout_vorname"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/textView7" />
</androidx.constraintlayout.widget.ConstraintLayout>
<Button
android:id="#+id/button3"
android:layout_width="150dp"
android:layout_height="50dp"
android:layout_marginStart="10dp"
android:layout_marginBottom="16dp"
android:onClick="zurueckZuMainActivity"
android:text="Zurück"
android:layout_alignParentBottom="true"/>
<Button
android:id="#+id/button4"
android:layout_width="150dp"
android:layout_height="50dp"
android:layout_marginEnd="10dp"
android:layout_marginBottom="16dp"
android:onClick="weiter"
android:text="Weiter"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
/>
</RelativeLayout>
You have used fillviewport="true" which basically increases the height of your scroll view to use remaining space if there is extra space available in viewport. If you will make it false, or just remove that attribute, the height of the constraint layout will be as you expected. By default, the value of fillviewport is false.

Android layout doesn´t resize when keyboard shows

as title says, i have a problem resizing my layout when keyboard appears, I did the same in new project and it works, nope in this project:
I have added "android:windowSoftInputMode="adjustResize" in my activity manifest file
This is my .xml file:
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/contentRegister1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:focusableInTouchMode="true">
<include
android:id="#+id/customActionBar"
layout="#layout/action_bar_text"
android:layout_width="0dp"
android:layout_height="?attr/actionBarSize"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<ScrollView
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#id/customActionBar">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="#+id/tvInfoRegister"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="30dp"
android:layout_marginTop="25dp"
android:layout_marginEnd="30dp"
android:text="#string/register_header_text"
android:textAlignment="center"
android:textColor="#ff999999"
android:textSize="13sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<com.google.android.material.textfield.TextInputLayout
android:id="#+id/nifRegisterBox"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="30dp"
android:layout_marginTop="22dp"
android:layout_marginEnd="30dp"
android:textColorHint="#android:color/black"
app:boxStrokeColor="#android:color/black"
app:errorEnabled="true"
app:hintTextAppearance="#style/TextFormStyle"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/tvInfoRegister">
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/nifRegisterValue"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="#string/nif_nie"
android:inputType="textCapCharacters"
android:maxLength="9"
android:maxLines="1"
android:textColor="#000000"
android:textSize="15sp" />
</com.google.android.material.textfield.TextInputLayout>
<ImageView
android:id="#+id/ivOkNifRegister"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:scaleType="fitCenter"
android:src="#drawable/ic_tick"
android:visibility="invisible"
app:layout_constraintBottom_toBottomOf="#id/nifRegisterBox"
app:layout_constraintEnd_toEndOf="#id/nifRegisterBox"
app:layout_constraintTop_toTopOf="#id/nifRegisterBox"
app:layout_constraintVertical_bias="0.39" />
<ImageView
android:id="#+id/ivWrongNifRegister"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:scaleType="fitCenter"
android:src="#drawable/ic_error"
android:visibility="invisible"
app:layout_constraintBottom_toBottomOf="#id/nifRegisterBox"
app:layout_constraintEnd_toEndOf="#id/nifRegisterBox"
app:layout_constraintTop_toTopOf="#id/nifRegisterBox"
app:layout_constraintVertical_bias="0.39" />
<com.google.android.material.textfield.TextInputLayout
android:id="#+id/birthRegisterBox"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="30dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="30dp"
android:textColorHint="#android:color/black"
app:boxStrokeColor="#android:color/black"
app:errorEnabled="true"
app:hintTextAppearance="#style/TextFormStyle"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/nifRegisterBox">
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/birthRegisterValue"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clickable="true"
android:focusable="false"
android:hint="#string/register_birthdate_label"
android:inputType="date"
android:maxLines="1"
android:singleLine="true"
android:textColor="#000000"
android:textSize="15sp" />
</com.google.android.material.textfield.TextInputLayout>
<ImageView
android:id="#+id/ivOkBirthRegister"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:scaleType="fitCenter"
android:src="#drawable/ic_tick"
android:visibility="invisible"
app:layout_constraintBottom_toBottomOf="#id/birthRegisterBox"
app:layout_constraintEnd_toEndOf="#id/birthRegisterBox"
app:layout_constraintTop_toTopOf="#id/birthRegisterBox"
app:layout_constraintVertical_bias="0.39" />
<ImageView
android:id="#+id/ivWrongBirthRegister"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:scaleType="fitCenter"
android:src="#drawable/ic_error"
android:visibility="invisible"
app:layout_constraintBottom_toBottomOf="#id/birthRegisterBox"
app:layout_constraintEnd_toEndOf="#id/birthRegisterBox"
app:layout_constraintTop_toTopOf="#id/birthRegisterBox"
app:layout_constraintVertical_bias="0.39" />
<com.google.android.material.textfield.TextInputLayout
android:id="#+id/mailRegisterBox"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="30dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="30dp"
android:textColorHint="#android:color/black"
app:boxStrokeColor="#android:color/black"
app:errorEnabled="true"
app:hintTextAppearance="#style/TextFormStyle"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/birthRegisterBox">
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/mailRegisterValue"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="#string/register_email_label"
android:inputType="textEmailAddress"
android:maxLines="1"
android:textColor="#000000"
android:textSize="15sp" />
</com.google.android.material.textfield.TextInputLayout>
<ImageView
android:id="#+id/ivOkMailRegister"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:scaleType="fitCenter"
android:src="#drawable/ic_tick"
android:visibility="invisible"
app:layout_constraintBottom_toBottomOf="#id/mailRegisterBox"
app:layout_constraintEnd_toEndOf="#id/mailRegisterBox"
app:layout_constraintTop_toTopOf="#id/mailRegisterBox"
app:layout_constraintVertical_bias="0.39" />
<ImageView
android:id="#+id/ivWrongMailRegister"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:scaleType="fitCenter"
android:src="#drawable/ic_error"
android:visibility="invisible"
app:layout_constraintBottom_toBottomOf="#id/mailRegisterBox"
app:layout_constraintEnd_toEndOf="#id/mailRegisterBox"
app:layout_constraintTop_toTopOf="#id/mailRegisterBox"
app:layout_constraintVertical_bias="0.39" />
<com.google.android.material.textfield.TextInputLayout
android:id="#+id/remailRegisterBox"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="30dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="30dp"
android:textColorHint="#android:color/black"
app:boxStrokeColor="#android:color/black"
app:errorEnabled="true"
app:hintTextAppearance="#style/TextFormStyle"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/mailRegisterBox">
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/remailRegisterValue"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="#string/register_email_confirm_label"
android:inputType="textEmailAddress"
android:maxLines="1"
android:textColor="#000000"
android:textSize="15sp" />
</com.google.android.material.textfield.TextInputLayout>
<ImageView
android:id="#+id/ivOkReMailRegister"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:scaleType="fitCenter"
android:src="#drawable/ic_tick"
android:visibility="invisible"
app:layout_constraintBottom_toBottomOf="#id/remailRegisterBox"
app:layout_constraintEnd_toEndOf="#id/remailRegisterBox"
app:layout_constraintTop_toTopOf="#id/remailRegisterBox"
app:layout_constraintVertical_bias="0.39" />
<ImageView
android:id="#+id/ivWrongReMailRegister"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:scaleType="fitCenter"
android:src="#drawable/ic_error"
android:visibility="invisible"
app:layout_constraintBottom_toBottomOf="#id/remailRegisterBox"
app:layout_constraintEnd_toEndOf="#id/remailRegisterBox"
app:layout_constraintTop_toTopOf="#id/remailRegisterBox"
app:layout_constraintVertical_bias="0.39" />
<com.google.android.material.textfield.TextInputLayout
android:id="#+id/mobileRegisterBox"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="30dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="30dp"
android:textColorHint="#android:color/black"
app:boxStrokeColor="#android:color/black"
app:errorEnabled="true"
app:hintTextAppearance="#style/TextFormStyle"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/remailRegisterBox">
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/mobileRegisterValue"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="#string/register_mobile_phone_label"
android:inputType="number"
android:maxLength="9"
android:maxLines="1"
android:textColor="#000000"
android:textSize="15sp" />
</com.google.android.material.textfield.TextInputLayout>
<ImageView
android:id="#+id/ivOkMobileRegister"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:scaleType="fitCenter"
android:src="#drawable/ic_tick"
android:visibility="invisible"
app:layout_constraintBottom_toBottomOf="#id/mobileRegisterBox"
app:layout_constraintEnd_toEndOf="#id/mobileRegisterBox"
app:layout_constraintTop_toTopOf="#id/mobileRegisterBox"
app:layout_constraintVertical_bias="0.39" />
<ImageView
android:id="#+id/ivWrongMobileRegister"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:scaleType="fitCenter"
android:src="#drawable/ic_error"
android:visibility="invisible"
app:layout_constraintBottom_toBottomOf="#id/mobileRegisterBox"
app:layout_constraintEnd_toEndOf="#id/mobileRegisterBox"
app:layout_constraintTop_toTopOf="#id/mobileRegisterBox"
app:layout_constraintVertical_bias="0.39" />
<LinearLayout
android:id="#+id/check_box_and_text"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="30dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="30dp"
android:clickable="true"
android:focusable="true"
android:gravity="center_vertical"
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/mobileRegisterBox">
<CheckBox
android:id="#+id/legales"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="9dp"
android:button="#drawable/checkbox_selector" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="4dp"
android:text="#string/register_legales_label"
android:textSize="13sp" />
<TextView
android:id="#+id/termsOfAgreement"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/register_legales_label_hiperlink"
android:textColor="#ffd87920"
android:textSize="13sp" />
</LinearLayout>
<TextView
android:id="#+id/tvErrorLegal"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="30dp"
android:layout_marginEnd="30dp"
android:text="#string/condiciones_legales_error"
android:textColor="#ff0000"
android:textSize="12sp"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#id/check_box_and_text" />
<Button
android:id="#+id/btNextRegister1"
style="#style/LoginButtonEntrarStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="30dp"
android:layout_marginTop="27dp"
android:layout_marginEnd="30dp"
android:layout_marginBottom="32dp"
android:background="#drawable/button_main_card_dashboard"
android:text="#string/request_reset_password_init_button_next"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/tvErrorLegal" />
</androidx.constraintlayout.widget.ConstraintLayout>
And this is the include file:
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="#drawable/dashboard_title_bg">
<TextView
android:id="#+id/actionBarCentralTextView"
style="#style/MainTitleActionBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.6" />
<ImageButton
android:id="#+id/btActionBarMenuText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:background="?android:selectableItemBackground"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.6" />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="#+id/back_container_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.6">
<ImageButton
android:id="#+id/btActionBarNotificationsText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:background="?android:selectableItemBackground"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="#+id/tvSecondTitleText"
style="#style/SecondaryTitleActionBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
Anyone knows why it is not resizing?
Thanks,
By it's standard documentation:
Boolean internal attribute to adjust view layout based on system windows such as the status bar. If true, adjusts the padding of this view to leave space for the system windows.
I think your problem would be solved by adding android:fitsSystemWindows=true to your root view.

wrap_content of LinearLayout which include FAB and text

I've added a LinearLayout which include a FAB and text to my XML.
the height and width of the LinearLayout were set to 'wrap_content', but for some reason in the Design tab of the XML the box of the LinearLayout seems to have a larger and unnecessary height. How can I make the LinearLayout be at about the same height as the FAB and the text?
Thanks
here is the XML code:
<?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="corp.blayzer.randomit.MainActivity">
<LinearLayout
android:id="#+id/linearLayout"
android:layout_width="match_parent"
android:layout_height="186dp"
android:background="#color/mainBackGroundHalf1"
android:gravity="center"
android:orientation="vertical"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<android.support.design.widget.TextInputLayout
android:id="#+id/minVal_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:gravity="center"
app:layout_constraintEnd_toEndOf="#+id/linearLayout"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="#+id/linearLayout">
<EditText
android:id="#+id/minVal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:backgroundTint="#color/inputText"
android:ems="10"
android:hint="#string/minValue"
android:inputType="number"
android:selectAllOnFocus="false"
android:singleLine="true"
android:textAlignment="center"
android:textAppearance="#style/TextAppearance.AppCompat.Body1"
android:textColorHint="#color/inputText"
app:layout_constraintHorizontal_bias="0.502"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/maxVal_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:gravity="center"
app:layout_constraintEnd_toEndOf="#+id/linearLayout"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/minVal_layout">
<EditText
android:id="#+id/maxVal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginTop="16dp"
android:backgroundTint="#color/inputText"
android:ems="10"
android:hint="#string/maxValue"
android:inputType="number"
android:selectAllOnFocus="false"
android:singleLine="true"
android:textAlignment="center"
android:textAppearance="#style/TextAppearance.AppCompat.Body1"
android:textColorHint="#color/inputText"
app:layout_constraintBottom_toBottomOf="#+id/linearLayout"
app:layout_constraintHorizontal_bias="0.502"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent" />
</android.support.design.widget.TextInputLayout>
<TextView
android:id="#+id/textNumView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:lineSpacingExtra="8sp"
android:text="#string/instructionsMainAct"
android:textAppearance="#android:style/TextAppearance"
android:textColor="#android:color/holo_red_light"
android:textSize="18sp"
android:textStyle="bold"
app:layout_constraintHorizontal_bias="0.506"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="#+id/linearLayout"
app:layout_constraintVertical_chainStyle="packed" />
<LinearLayout
android:id="#+id/layOutBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/textNumView">
<android.support.design.widget.FloatingActionButton
android:id="#+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="252dp"
android:layout_marginEnd="16dp"
android:layout_marginStart="16dp"
android:layout_weight="0"
android:clickable="true"
android:focusable="true"
app:layout_constraintHorizontal_bias="0.498"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/textNumView"
app:srcCompat="#drawable/ic_change_history_black_24dp"
tools:text="#string/GoButton" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="10"
android:ellipsize="end"
android:gravity="center"
android:maxLines="1"
android:text="#string/GoButton"
android:textAlignment="center"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#android:color/black" />
</LinearLayout> </android.support.constraint.ConstraintLayout>
ScreenShot of the layout:
You had a large margin for the fab: android:layout_marginBottom="252dp" which must be removed or changed. Use this:
<?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="corp.blayzer.randomit.MainActivity">
<LinearLayout
android:id="#+id/linearLayout"
android:layout_width="match_parent"
android:layout_height="186dp"
android:background="#color/mainBackGroundHalf1"
android:gravity="center"
android:orientation="vertical"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<android.support.design.widget.TextInputLayout
android:id="#+id/minVal_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:gravity="center"
app:layout_constraintEnd_toEndOf="#+id/linearLayout"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="#+id/linearLayout">
<EditText
android:id="#+id/minVal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:backgroundTint="#color/inputText"
android:ems="10"
android:hint="#string/minValue"
android:inputType="number"
android:selectAllOnFocus="false"
android:singleLine="true"
android:textAlignment="center"
android:textAppearance="#style/TextAppearance.AppCompat.Body1"
android:textColorHint="#color/inputText"
app:layout_constraintHorizontal_bias="0.502"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/maxVal_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:gravity="center"
app:layout_constraintEnd_toEndOf="#+id/linearLayout"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/minVal_layout">
<EditText
android:id="#+id/maxVal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginTop="16dp"
android:backgroundTint="#color/inputText"
android:ems="10"
android:hint="#string/maxValue"
android:inputType="number"
android:selectAllOnFocus="false"
android:singleLine="true"
android:textAlignment="center"
android:textAppearance="#style/TextAppearance.AppCompat.Body1"
android:textColorHint="#color/inputText"
app:layout_constraintBottom_toBottomOf="#+id/linearLayout"
app:layout_constraintHorizontal_bias="0.502"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent" />
</android.support.design.widget.TextInputLayout>
<TextView
android:id="#+id/textNumView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:lineSpacingExtra="8sp"
android:text="#string/instructionsMainAct"
android:textAppearance="#android:style/TextAppearance"
android:textColor="#android:color/holo_red_light"
android:textSize="18sp"
android:textStyle="bold"
app:layout_constraintHorizontal_bias="0.506"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="#+id/linearLayout"
app:layout_constraintVertical_chainStyle="packed" />
<LinearLayout
android:id="#+id/layOutBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/textNumView">
<android.support.design.widget.FloatingActionButton
android:id="#+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:layout_marginStart="16dp"
android:layout_weight="0"
android:clickable="true"
android:focusable="true"
app:srcCompat="#drawable/ic_change_history_black_24dp"
tools:text="#string/GoButton" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="10"
android:ellipsize="end"
android:gravity="center"
android:maxLines="1"
android:text="#string/GoButton"
android:textAlignment="center"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#android:color/black" />
</LinearLayout>
</android.support.constraint.ConstraintLayout>
remove this line>>
android:layout_marginBottom="252dp"
from your
< FloatingActionButton >
Remove this
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
And it should work. What you're doing with those constraints is making it stretch to top and bottom.

ConstraintLayout: z-index issue

I am using ConstraintLayout for activity:
<?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="com.site.path.to.AuthenticationActivity">
<EditText
android:id="#+id/login"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:inputType="none"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
<EditText
android:id="#+id/password"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:inputType="textPassword"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="#+id/login"/>
<Button
android:id="#+id/login_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Log in"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="#+id/password"/>
<FrameLayout
android:visibility="gone"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="#color/default_background"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent">
</FrameLayout>
</android.support.constraint.ConstraintLayout>
FrameLayout should hide all content of the page when visible. But it hides all content except button. Why the button doesn't hide? How to fix it?
Editted:
Try to set android:stateListAnimator="#null" to the Button/AppCompatButton
In Lollipop (Android 5.0 (API 21)) and above, Buttons have a default elevation which causes them to always draw on top.
<?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">
<ImageView
android:id="#+id/background_image"
android:layout_width="0dp"
android:layout_height="0dp"
android:scaleType="centerCrop"
android:tint="#80000000"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="#+id/logo"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="32dp"
android:layout_marginLeft="32dp"
android:layout_marginRight="32dp"
android:layout_marginStart="32dp"
android:layout_marginTop="24dp"
android:src="#drawable/logo"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="#+id/background_image"
app:layout_constraintVertical_bias="0.049"
tools:layout_constraintLeft_creator="1"
tools:layout_constraintRight_creator="1" />
<TextView
android:id="#+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginEnd="7dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="7dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:fontFamily="sans-serif-light"
android:text="There is More"
android:textColor="#android:color/white"
app:layout_constraintBottom_toTopOf="#+id/scrollView2"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="#+id/logo"
app:layout_constraintTop_toTopOf="#+id/logo"
app:layout_constraintVertical_bias="1.0"
tools:ignore="HardcodedText" />
<ScrollView
android:id="#+id/scrollView2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginEnd="32dp"
android:layout_marginLeft="32dp"
android:layout_marginRight="32dp"
android:layout_marginStart="32dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="#+id/logo"
app:layout_constraintVertical_bias="0.050000012">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<android.support.design.widget.TextInputLayout
android:id="#+id/input_layout_first_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="#style/ThemeEditTextLight">
<EditText
android:id="#+id/input_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Name"
android:inputType="textPersonName"
android:theme="#style/ThemeEditTextLight" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/input_layout_email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="#style/ThemeEditTextLight">
<EditText
android:id="#+id/input_email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Email"
android:inputType="textEmailAddress"
android:theme="#style/ThemeEditTextLight" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/input_layout_phone"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="#style/ThemeEditTextLight">
<EditText
android:id="#+id/input_phone"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Phone"
android:inputType="phone"
android:theme="#style/ThemeEditTextLight" />
</android.support.design.widget.TextInputLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<android.support.design.widget.TextInputLayout
android:id="#+id/input_layout_password"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:theme="#style/ThemeEditTextLight">
<EditText
android:id="#+id/input_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Password"
android:inputType="textPassword"
android:theme="#style/ThemeEditTextLight" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>
</LinearLayout>
</ScrollView>
<android.support.v7.widget.AppCompatButton
android:id="#+id/sign_up_button"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginEnd="32dp"
android:layout_marginLeft="32dp"
android:layout_marginRight="32dp"
android:layout_marginStart="32dp"
android:layout_marginTop="16dp"
android:backgroundTint="#2a98f0"
android:stateListAnimator="#null"
android:elevation="0dp"
android:paddingBottom="16dp"
android:paddingTop="16dp"
android:text="Sign up"
android:textColor="#android:color/white"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="#+id/scrollView2"
app:layout_constraintVertical_bias="0.100000024" />
<TextView
android:id="#+id/or_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginStart="8dp"
android:fontFamily="sans-serif-light"
android:gravity="center"
android:text="or\nSign up with social sites"
android:textColor="#color/white"
app:layout_constraintBottom_toTopOf="#+id/imageView6"
app:layout_constraintHorizontal_bias="0.501"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent" />
<ImageView
android:id="#+id/imageView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintHorizontal_bias="0.501"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="#+id/or_tv"
app:layout_constraintVertical_bias="0.8"
app:srcCompat="#drawable/ic_google_plus" />
<FrameLayout
android:id="#+id/progressBar"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="#color/red"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ProgressBar
android:id="#+id/progressBarChild"
style="?android:attr/progressBarStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center" />
</FrameLayout>
</android.support.constraint.ConstraintLayout>
This worked for me.
The problem is (as #motis10 noted) that Buttons have elevation by default (post Android 5.0), so they are drawn above other things that have no elevation.
If you give the thing you want drawn over the button a higher elevation value, then it will be drawn on top. I used: android:elevation="40dp" just to be safe, but I believe 8dp is the default button elevation.

Categories

Resources