DialogFragment resizing when keyboard is shown, but not scrollable - android

I have a DialogFragment with EditTexts in it. When I open it, the keyboard pops up and hides half of the dialog. Because of that I've used getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE); inside the onCreateView. The dialog will resize all right, but it is not scrollable, so I can't get to the other EditTexts and button.
Here's my XML:
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:id="#+id/iv_logo_image"
android:layout_width="200dp"
android:layout_height="80dp"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="16dp"
android:layout_marginTop="16dp"
app:srcCompat="#drawable/logo" />
<LinearLayout
android:id="#+id/ll_register_form"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/iv_logo_image"
android:layout_centerHorizontal="true"
android:layout_margin="#dimen/screen_edge_margin"
android:orientation="vertical">
<EditText
android:id="#+id/et_first_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp"
android:background="#drawable/drawable_border"
android:hint="#string/first_name"
android:inputType="text"
android:padding="5dp"
android:textColorHint="#color/gray_400"
android:textSize="14sp" />
<EditText
android:id="#+id/et_last_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp"
android:background="#drawable/drawable_border"
android:hint="#string/last_name"
android:inputType="text"
android:padding="5dp"
android:textColorHint="#color/gray_400"
android:textSize="14sp" />
<EditText
android:id="#+id/et_company_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp"
android:background="#drawable/drawable_border"
android:hint="#string/company_name_hint"
android:inputType="text"
android:padding="5dp"
android:textColorHint="#color/gray_400"
android:textSize="14sp" />
<EditText
android:id="#+id/et_email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp"
android:background="#drawable/drawable_border"
android:hint="#string/username"
android:inputType="textEmailAddress"
android:padding="5dp"
android:textColorHint="#color/gray_400"
android:textSize="14sp" />
<EditText
android:id="#+id/et_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp"
android:background="#drawable/drawable_border"
android:hint="#string/password"
android:inputType="textPassword"
android:padding="5dp"
android:textColorHint="#color/gray_400"
android:textSize="14sp" />
<EditText
android:id="#+id/et_confirm_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp"
android:background="#drawable/drawable_border"
android:hint="#string/confirm_password"
android:inputType="textPassword"
android:padding="5dp"
android:textColorHint="#color/gray_400"
android:textSize="14sp" />
</LinearLayout>
<TextView
android:id="#+id/tv_register_now"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/ll_register_form"
android:layout_centerHorizontal="true"
android:layout_marginTop="16dp"
android:text="Already registered? Login me!"
android:textColor="#color/light_blue_900"
android:textSize="14sp" />
<Button
android:id="#+id/btn_register"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/tv_register_now"
android:layout_centerHorizontal="true"
android:layout_marginTop="16dp"
android:background="#drawable/selector_button_blue"
android:text="#string/btn_register"
android:textColor="#color/white"
android:textSize="#dimen/medium_14" />
<ProgressBar
android:id="#+id/progress_bar"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_centerInParent="true"
android:visibility="gone" />
</RelativeLayout>
</ScrollView>

In activity add android:windowSoftInputMode="adjustResize" in manifest
<activity android:name="YourActivity"
android:windowSoftInputMode="adjustResize" />

Related

when i want to edit a text, my button goes up because its constraint to the bottom how can i prevent that?

I don't want the text to come up with the keyboard. is there a code so it stays at the bottom. i tried to constraint in to the top but then there is some space between my buttons and the bottom of my screen and i dont want that i want it at the bottom against the bottom line of the screen
before i click my editview
after i clicked my editview
here is my Layoutcode
<?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=".ProductInfo">
<ScrollView
android:id="#+id/scrollView"
android:layout_width="wrap_content"
android:layout_height="202dp"
android:layout_marginBottom="1dp"
app:layout_constraintBottom_toTopOf="#+id/saveBtn"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toStartOf="parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TableLayout
android:id="#+id/tableLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/textView2"
android:layout_width="219dp"
android:layout_height="wrap_content"
android:text="Location"
android:textSize="20dp"
android:textStyle="bold" />
<TextView
android:id="#+id/textView"
android:layout_width="191dp"
android:layout_height="wrap_content"
android:text="Datum"
android:textSize="20dp"
android:textStyle="bold" />
</TableRow>
<TableRow
android:id="#+id/locatieTbl"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent">
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent" />
</TableLayout>
</LinearLayout>
</ScrollView>
<TextView
android:id="#+id/nameTxt"
android:layout_width="391dp"
android:layout_height="76dp"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="24dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:longClickable="true"
android:text="Titel"
android:textIsSelectable="true"
android:textSize="25dp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/eanInputTxt" />
<Button
android:id="#+id/saveBtn"
style="#style/Widget.AppCompat.Button.Colored"
android:layout_width="205dp"
android:layout_height="wrap_content"
android:onClick="Savebtn"
android:text="Opslaan"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="#+id/cancelBtn" />
<Button
android:id="#+id/cancelBtn"
style="#style/Widget.AppCompat.Button"
android:layout_width="205dp"
android:layout_height="wrap_content"
android:onClick="Cancellbtn"
android:text="Annulleer"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="#+id/saveBtn"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent" />
<TextView
android:id="#+id/idEanTxt"
android:layout_width="200dp"
android:layout_height="29dp"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:longClickable="true"
android:text="IdOrEan"
android:textIsSelectable="true"
android:textSize="18dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/imageView" />
<EditText
android:id="#+id/Location"
android:layout_width="191dp"
android:layout_height="29dp"
android:layout_marginEnd="4dp"
android:layout_marginRight="4dp"
android:background="#null"
android:ems="10"
android:hint="Geen Vaknummer"
android:inputType="textPersonName"
android:longClickable="true"
android:textIsSelectable="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="#+id/Quantity" />
<EditText
android:id="#+id/Quantity"
android:layout_width="191dp"
android:layout_height="29dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="4dp"
android:layout_marginRight="4dp"
android:background="#null"
android:ems="10"
android:hint="Aantal"
android:inputType="textPersonName"
android:longClickable="true"
android:textIsSelectable="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="#+id/nameTxt" />
<EditText
android:id="#+id/eanInputTxt"
android:layout_width="260dp"
android:layout_height="42dp"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="24dp"
android:ems="10"
android:hint="Ean"
android:inputType="textPersonName"
android:longClickable="true"
android:text="0000030098572"
android:textIsSelectable="true"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="#+id/imageView"
android:layout_width="180dp"
android:layout_height="193dp"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="8dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/nameTxt" />
<Button
android:id="#+id/Search"
android:layout_width="79dp"
android:layout_height="42dp"
android:layout_marginStart="2dp"
android:layout_marginLeft="2dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:onClick="SearchEan"
android:text="Zoeken"
app:layout_constraintBaseline_toBaselineOf="#+id/eanInputTxt"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="#+id/Scanner" />
<Button
android:id="#+id/Scanner"
android:layout_width="46dp"
android:layout_height="42dp"
android:layout_marginStart="4dp"
android:layout_marginLeft="4dp"
android:layout_marginTop="24dp"
android:background="#android:drawable/ic_menu_camera"
android:onClick="scanner"
app:layout_constraintEnd_toStartOf="#+id/Search"
app:layout_constraintStart_toEndOf="#+id/eanInputTxt"
app:layout_constraintTop_toTopOf="parent" />
<SurfaceView
android:id="#+id/surface_view"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.333"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="#+id/backBtn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="backBtn"
android:text="Terug"
android:visibility="gone"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/scrollView" />
</androidx.constraintlayout.widget.ConstraintLayout>`
AdjustPan : The activity's main window is not resized to make room for the soft keyboard. Rather, the contents of the window are automatically panned so that the current focus is never obscured by the keyboard and users can always see what they are typing.
AdjustNothing : The window does not change at all here and the keyboard appears on top of it.
<activity android:name=".YourActivity" android:windowSoftInputMode="adjustPan"> </activity>
You can try one of them. Add your manifest file.

Background Image gone compressed when keyboard is open

I am making signup page using this image background.
Background image
It Look like: Signup page
But when I focus on EditText and when keyboard is opened, the background image is compressed. How can I resolve this.
After Compressed :
Here XML code:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView 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:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/log_sign_bg">
</RelativeLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="260dp">
<EditText
android:id="#+id/editText"
style="#android:style/TextAppearance.Material.Medium"
android:layout_width="0dp"
android:layout_height="48dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:background="#drawable/edittext_background"
android:hint="Username"
android:inputType="textPersonName"
android:paddingLeft="8dp"
android:textAppearance="#android:style/TextAppearance.Material.Medium"
android:textSize="22dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<EditText
android:id="#+id/editText3"
style="#android:style/TextAppearance.Material.Medium"
android:layout_width="0dp"
android:layout_height="48dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_marginTop="16dp"
android:background="#drawable/edittext_background"
android:hint="Email"
android:inputType="textEmailAddress"
android:paddingLeft="8dp"
android:textAppearance="#android:style/TextAppearance.Material.Medium"
android:textSize="22dp"
app:layout_constraintEnd_toEndOf="#+id/editText"
app:layout_constraintStart_toStartOf="#+id/editText"
app:layout_constraintTop_toBottomOf="#+id/editText" />
<EditText
android:id="#+id/editText2"
android:layout_width="0dp"
android:layout_height="48dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_marginTop="16dp"
android:background="#drawable/edittext_background"
android:hint="Password"
android:inputType="textPassword"
android:paddingLeft="8dp"
android:textAppearance="#android:style/TextAppearance.Material.Medium"
android:textSize="22dp"
app:layout_constraintEnd_toEndOf="#+id/editText3"
app:layout_constraintStart_toStartOf="#+id/editText3"
app:layout_constraintTop_toBottomOf="#+id/editText3" />
<EditText
android:id="#+id/editText4"
android:layout_width="0dp"
android:layout_height="48dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_marginTop="16dp"
android:background="#drawable/edittext_background"
android:hint="Re-enter Password"
android:inputType="textPassword"
android:paddingLeft="8dp"
android:textAppearance="#android:style/TextAppearance.Material.Medium"
android:textSize="22dp"
app:layout_constraintEnd_toEndOf="#+id/editText2"
app:layout_constraintStart_toStartOf="#+id/editText2"
app:layout_constraintTop_toBottomOf="#+id/editText2" />
<Button
android:id="#+id/button"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_marginStart="64dp"
android:layout_marginTop="48dp"
android:layout_marginEnd="64dp"
android:background="#drawable/button_background"
android:text="Register"
android:textAppearance="#android:style/TextAppearance.Material.Large"
android:textColor="#FFF"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="#+id/editText4"
app:layout_constraintStart_toStartOf="#+id/editText4"
app:layout_constraintTop_toBottomOf="#+id/editText4" />
<TextView
android:id="#+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_marginTop="24dp"
android:text="Already a member?"
android:textColor="#A6A6A6"
android:textSize="22dp"
app:layout_constraintEnd_toStartOf="#+id/textView2"
app:layout_constraintStart_toStartOf="#+id/button"
app:layout_constraintTop_toBottomOf="#+id/button" />
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_marginTop="24dp"
android:text="Login"
android:textColor="#EF3646"
android:textSize="22dp"
app:layout_constraintEnd_toEndOf="#+id/button"
app:layout_constraintStart_toEndOf="#+id/textView"
app:layout_constraintTop_toBottomOf="#+id/button" />
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>
I tried to many ways but i think i have to separate the bakgrounf image and the logo one may be fix it.
Into your AndroidManifest.xml file add below line to your activity
android:windowSoftInputMode="stateVisible|adjustPan"
Like below snippet register in
<activity
android:name=".MainActivity"
android:screenOrientation="portrait"
android:theme="#style/AppTheme.NoActionBar"
android:windowSoftInputMode="stateVisible|adjustPan|adjustResize" />
You mentioned issue in comment section so solution is here,
Run time Set Edittext Hint:
EditText etName;
etName= (EditText) findViewById(R.id.etName);
etName.setHint("Your Hint");
Your xml file is not correct ScrollView can not contain multiple child, i have resolved your problem.So Please follow my answer.
if you want to scroll only view not top image then use this one
<?xml version="1.0" encoding="utf-8"?>
<ScrollView 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:fillViewport="true"
android:orientation="vertical">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/signup_bg"
>
<EditText
android:id="#+id/editText"
android:layout_width="0dp"
android:layout_height="48dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_marginStart="16dp"
android:layout_marginTop="260dp"
android:layout_marginEnd="16dp"
android:hint="Username"
android:inputType="textPersonName"
android:paddingLeft="8dp"
android:textSize="22dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<EditText
android:id="#+id/editText3"
android:layout_width="0dp"
android:layout_height="48dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_marginTop="16dp"
android:hint="Email"
android:inputType="textEmailAddress"
android:paddingLeft="8dp"
android:textSize="22dp"
app:layout_constraintEnd_toEndOf="#+id/editText"
app:layout_constraintStart_toStartOf="#+id/editText"
app:layout_constraintTop_toBottomOf="#+id/editText" />
<EditText
android:id="#+id/editText2"
android:layout_width="0dp"
android:layout_height="48dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_marginTop="16dp"
android:hint="Password"
android:inputType="textPassword"
android:paddingLeft="8dp"
android:textSize="22dp"
app:layout_constraintEnd_toEndOf="#+id/editText3"
app:layout_constraintStart_toStartOf="#+id/editText3"
app:layout_constraintTop_toBottomOf="#+id/editText3" />
<EditText
android:id="#+id/editText4"
android:layout_width="0dp"
android:layout_height="48dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_marginTop="16dp"
android:hint="Re-enter Password"
android:inputType="textPassword"
android:paddingLeft="8dp"
android:textSize="22dp"
app:layout_constraintEnd_toEndOf="#+id/editText2"
app:layout_constraintStart_toStartOf="#+id/editText2"
app:layout_constraintTop_toBottomOf="#+id/editText2" />
<Button
android:id="#+id/button"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_marginStart="64dp"
android:layout_marginTop="48dp"
android:layout_marginEnd="64dp"
android:background="#EF3646"
android:text="Register"
android:textColor="#FFF"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="#+id/editText4"
app:layout_constraintStart_toStartOf="#+id/editText4"
app:layout_constraintTop_toBottomOf="#+id/editText4" />
<TextView
android:id="#+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_marginTop="24dp"
android:text="Already a member?"
android:textColor="#A6A6A6"
android:textSize="22dp"
app:layout_constraintEnd_toStartOf="#+id/textView2"
app:layout_constraintStart_toStartOf="#+id/button"
app:layout_constraintTop_toBottomOf="#+id/button" />
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_marginTop="24dp"
android:text="Login"
android:textColor="#EF3646"
android:textSize="22dp"
app:layout_constraintEnd_toEndOf="#+id/button"
app:layout_constraintStart_toEndOf="#+id/textView"
app:layout_constraintTop_toBottomOf="#+id/button" />
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>

layout not going all the way to the bottom

I am new to designing layouts , and i am trying to make this layout resizable with
android:windowSoftInputMode="adjustResize"
everything is working perfectly but the problem is i can't get the last relative layout to go all the way to the bottom
i tried to set gravity to bottom but it did not work
i added a line in my code where my problem occurs
here is my activity layout:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView 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="#000000"
tools:context=".testLayout">
<RelativeLayout
android:id="#+id/mainLayout"
android:layout_width="match_parent"
android:gravity="center"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/logoLayout"
>
<ImageView
android:layout_width="140dp"
android:layout_height="35dp"
android:layout_marginTop="10dp"
android:layout_marginStart="10dp"
android:background="#drawable/nlogo">
</ImageView>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:id="#+id/logoLayout1"
android:layout_below="#id/logoLayout"
>
<EditText
android:id="#+id/testUsernameText"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginStart="50dp"
android:layout_marginTop="48dp"
android:layout_marginEnd="50dp"
android:background="#drawable/rounded_background"
android:gravity="center_vertical"
android:hint="Username"
android:paddingStart="10dp"
android:text=""
android:textColor="#color/white"
android:textColorHint="#color/hint_color"
android:textCursorDrawable="#null"
android:textSize="18sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/imageView2" />
<EditText
android:id="#+id/testPasswordText"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginStart="50dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="50dp"
android:background="#drawable/rounded_background"
android:gravity="center_vertical"
android:hint="Password"
android:paddingStart="10dp"
android:text=""
android:textColor="#color/white"
android:textColorHint="#color/hint_color"
android:textCursorDrawable="#null"
android:textSize="18sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/imageView2" />
<EditText
android:id="#+id/testEmailText"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginStart="50dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="50dp"
android:background="#drawable/rounded_background"
android:gravity="center_vertical"
android:hint="Email"
android:paddingStart="10dp"
android:text=""
android:textColor="#color/white"
android:textColorHint="#color/hint_color"
android:textCursorDrawable="#null"
android:textSize="18sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/imageView2" />
<EditText
android:id="#+id/testFullNameText"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginStart="50dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="50dp"
android:background="#drawable/rounded_background"
android:gravity="center_vertical"
android:hint="Full Name"
android:paddingStart="10dp"
android:text=""
android:textColor="#color/white"
android:textColorHint="#color/hint_color"
android:textCursorDrawable="#null"
android:textSize="18sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/imageView2" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="50dp"
android:layout_marginStart="50dp"
android:layout_marginEnd="50dp"
android:text="Sign Up"
android:background="#drawable/rounded_button"
/>
</LinearLayout>
<!-- here is the problem -->
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/logoLayout1"
android:id="#+id/footerLayout"
android:layout_alignParentBottom="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_alignParentBottom="true">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="false"
android:text="Welcome to ....."
android:textSize="15sp" />
</LinearLayout>
</RelativeLayout>
</RelativeLayout>
many thanks in advance
I have tried your layout in my temporary activity and adding android:fillViewport="true" in the ScrollView worked for me.
Here is the solution:
Add this line in Manifest file for your activity
android:windowSoftInputMode="adjustResize"
I have bit modified the XML file code to make it very easy to read and less view hierarchy.
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#000000"
android:fillViewport="true">
<LinearLayout
android:id="#+id/mainLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="140dp"
android:layout_height="35dp"
android:layout_marginStart="10dp"
android:layout_marginTop="10dp"
android:background="#drawable/ic_eye"
android:contentDescription="#null" />
<EditText
android:id="#+id/testUsernameText"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginStart="50dp"
android:layout_marginTop="48dp"
android:layout_marginEnd="50dp"
android:gravity="center_vertical"
android:hint="Username"
android:paddingStart="10dp"
android:text=""
android:textColor="#color/colorTextWhite"
android:textColorHint="#color/colorTextBlue"
android:textCursorDrawable="#null"
android:textSize="18sp" />
<EditText
android:id="#+id/testPasswordText"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginStart="50dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="50dp"
android:gravity="center_vertical"
android:hint="Password"
android:paddingStart="10dp"
android:text=""
android:textColor="#color/colorTextWhite"
android:textColorHint="#color/colorTextBlue"
android:textCursorDrawable="#null"
android:textSize="18sp" />
<EditText
android:id="#+id/testEmailText"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginStart="50dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="50dp"
android:gravity="center_vertical"
android:hint="Email"
android:paddingStart="10dp"
android:text=""
android:textColor="#color/colorTextWhite"
android:textColorHint="#color/colorTextBlue"
android:textCursorDrawable="#null"
android:textSize="18sp" />
<EditText
android:id="#+id/testFullNameText"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginStart="50dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="50dp"
android:gravity="center_vertical"
android:hint="Full Name"
android:paddingStart="10dp"
android:text=""
android:textColor="#color/colorTextWhite"
android:textColorHint="#color/colorTextBlue"
android:textCursorDrawable="#null"
android:textSize="18sp" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="50dp"
android:layout_marginTop="50dp"
android:layout_marginEnd="50dp"
android:background="#drawable/shape_calendar_bg"
android:text="Sign Up" />
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="bottom"
android:text="Welcome to ....."
android:textColor="#color/colorTextWhite"
android:textSize="15sp" />
</LinearLayout>
</ScrollView>
While the keyboard is open

editext not getting focus constraint layout

I have added xml for my layout edit text is not getting focus, only selects first one then cannot selects another edittext
I am afraid that somehow focus is not getting or is messed up but could not resolve it anyway.
maybe constraintlayout is culprit but no idea.
<?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"
android:background="#color/black">
<include
android:id="#+id/toolbar"
layout="#layout/toolbar_layout" />
<ScrollView
android:id="#+id/svScroll"
android:layout_width="0dp"
android:layout_height="0dp"
android:padding="10dp"
android:scrollbars="none"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/toolbar"
app:layout_constraintBottom_toTopOf="#+id/btUpdate"
>
<android.support.constraint.ConstraintLayout
android:id="#+id/constraint_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/black"
>
<EditText
android:id="#+id/etEmailid"
android:layout_width="match_parent"
android:layout_height="48dp"
android:background="#drawable/profile_background"
android:hint="#string/email_txt"
android:padding="10dp"
android:textColor="#color/white"
android:textColorHint="#color/white"
android:textSize="16sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:inputType="text" />
<EditText
android:id="#+id/etFirstName"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginTop="10dp"
android:background="#drawable/profile_background"
android:padding="10dp"
android:hint="#string/First_name"
android:textColorHint="#color/white"
android:textColor="#color/white"
android:textSize="16sp"
android:inputType="textCapWords"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/etEmailid"
/>
<EditText
android:id="#+id/etLastName"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginTop="10dp"
android:background="#drawable/profile_background"
android:padding="10dp"
android:hint="#string/last_name"
android:inputType="textCapWords"
android:textColorHint="#color/white"
android:textColor="#color/white"
android:textSize="16sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/etFirstName" />
<TextView
android:id="#+id/dob"
android:layout_width="0dp"
android:layout_height="50dp"
android:layout_marginTop="10dp"
android:background="#drawable/profile_background"
android:drawablePadding="10dp"
android:drawableEnd="#mipmap/mdate"
android:gravity="center_vertical"
android:padding="10dp"
android:hint="#string/dob"
android:textColorHint="#color/white"
android:textColor="#color/white"
android:textSize="16sp"
app:layout_constraintEnd_toStartOf="#+id/genderSpinner"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/etLastName" />
<Spinner
android:id="#+id/genderSpinner"
android:layout_width="0dp"
android:layout_height="50dp"
android:layout_marginStart="10dp"
android:background="#drawable/profile_background"
android:entries="#array/gender"
android:textColor="#color/white"
android:textColorHint="#color/white"
android:textSize="16sp"
app:layout_constraintBottom_toBottomOf="#+id/dob"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="#+id/dob"
app:layout_constraintTop_toTopOf="#+id/dob"/>
<EditText
android:id="#+id/etMobileno"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginTop="10dp"
android:background="#drawable/profile_background"
android:padding="10dp"
android:hint="#string/mobile_txt"
android:textColor="#color/white"
android:textColorHint="#color/white"
android:textSize="16sp"
android:inputType="number"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/genderSpinner" />
<EditText
android:id="#+id/etAddress"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginTop="10dp"
android:background="#drawable/profile_background"
android:padding="10dp"
android:hint="#string/address"
android:inputType="textCapWords"
android:textColorHint="#color/white"
android:textColor="#color/white"
android:textSize="16sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/etMobileno" />
<EditText
android:id="#+id/etCity"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginTop="10dp"
android:background="#drawable/profile_background"
android:padding="10dp"
android:hint="#string/S_city"
android:textColor="#color/white"
android:textColorHint="#color/white"
android:textSize="16sp"
android:inputType="textCapWords"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/etAddress" />
<EditText
android:id="#+id/etPincode"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginTop="10dp"
android:background="#drawable/profile_background"
android:padding="10dp"
android:hint="#string/pincode"
android:textColor="#color/white"
android:textColorHint="#color/white"
android:textSize="16sp"
android:inputType="number"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/etCity" />
<TextView
android:id="#+id/tvMandatory"
android:layout_width="match_parent"
android:layout_height="12dp"
android:layout_marginTop="10dp"
android:text="#string/mandatory"
android:textColor="#color/white"
android:textSize="10sp"
android:gravity="right"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="#+id/etPincode" />
<de.hdodenhof.circleimageview.CircleImageView
android:id="#+id/ivProfile"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_marginTop="10dp"
android:src="#drawable/prof_img"
app:civ_border_color="#000"
app:civ_border_width="0.5dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="#+id/tvMandatory" />
<TextView
android:id="#+id/tvChoosePhoto"
android:layout_width="150dp"
android:layout_height="40dp"
android:layout_marginLeft="16dp"
android:background="#drawable/prof_cam"
android:gravity="center|left"
android:paddingLeft="#dimen/plus_15dp"
android:text="CHOOSE YOUR PHOTO"
android:textColor="#color/black"
android:textSize="10sp"
app:layout_constraintBottom_toBottomOf="#+id/ivProfile"
app:layout_constraintLeft_toRightOf="#+id/ivProfile"
app:layout_constraintTop_toTopOf="#+id/ivProfile" />
<TextView
android:id="#+id/tvClear"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="32dp"
android:gravity="center|left"
android:text="#string/clear"
android:textColor="#color/white"
app:layout_constraintBottom_toBottomOf="#+id/tvChoosePhoto"
app:layout_constraintLeft_toRightOf="#+id/tvChoosePhoto"
app:layout_constraintTop_toTopOf="#+id/tvChoosePhoto"
tools:ignore="MissingConstraints" />
</android.support.constraint.ConstraintLayout>
</ScrollView>
<Button
android:id="#+id/btUpdate"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/btn_update"
android:text="UPDATE"
android:layout_marginBottom="10dp"
android:textColor="#color/white"
android:layout_marginLeft="40dp"
android:layout_marginRight="40dp"
app:layout_constraintBottom_toBottomOf="parent"
/>
</android.support.constraint.ConstraintLayout>
This shows that I am using scrollview inside constraintlayout which has multiple edit texts and cannot focus second or any of other elements
You can use android:imeOptions="actionNext" to get focus on next EditText item in layout. I have used EditText( or AppCompatEditText) within ConstrainLayout in Scrollview, it working fine.

ScrollView doesn't work properly

I have two XML layout files, each has a ScrollView as parent.
While one is working properly, the other one doesn't (each XML has the same hierarchy).
activity_login.xml
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<android.support.constraint.ConstraintLayout
android:id="#+id/login_container"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="#+id/tvLogo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/logo"
android:textSize="50sp"
app:layout_constraintBottom_toTopOf="#+id/guideline2"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<android.support.constraint.Guideline
android:id="#+id/guideline2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.25" />
<TextView
android:id="#+id/tvRegisterLabel"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="3dp"
android:layout_marginStart="3dp"
android:text="#string/btn_login"
android:textSize="20sp"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintLeft_toLeftOf="#+id/guideline3"
app:layout_constraintRight_toLeftOf="#+id/guideline6"
app:layout_constraintTop_toTopOf="#+id/guideline2" />
<android.support.design.widget.TextInputLayout
android:id="#+id/textInputLayout2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
app:layout_constraintLeft_toLeftOf="#+id/guideline3"
app:layout_constraintRight_toLeftOf="#+id/guideline6"
app:layout_constraintTop_toBottomOf="#+id/tvRegisterLabel">
<EditText
android:id="#+id/etEmail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="#string/et_email_hint"
android:inputType="textEmailAddress"
android:maxLength="70"
android:maxLines="1"
android:minLines="1"
android:text="akarki#yahoo.com"
android:textSize="#dimen/et_hint_size" />
</android.support.design.widget.TextInputLayout>
<android.support.constraint.Guideline
android:id="#+id/guideline3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.15" />
<android.support.constraint.Guideline
android:id="#+id/guideline6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.85" />
<android.support.design.widget.TextInputLayout
android:id="#+id/textInputLayout7"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintLeft_toLeftOf="#+id/guideline3"
app:layout_constraintRight_toLeftOf="#+id/guideline6"
app:layout_constraintTop_toBottomOf="#+id/textInputLayout2">
<EditText
android:id="#+id/etPassword"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="#string/et_password_hint"
android:inputType="textPassword"
android:maxLength="30"
android:maxLines="1"
android:minLines="1"
android:text="1234qwer"
android:textSize="#dimen/et_hint_size" />
</android.support.design.widget.TextInputLayout>
<ProgressBar
android:id="#+id/progressBar"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="8dp"
android:visibility="invisible"
app:layout_constraintLeft_toLeftOf="#+id/guideline3"
app:layout_constraintRight_toLeftOf="#+id/guideline6"
app:layout_constraintTop_toBottomOf="#+id/textInputLayout7" />
<Button
android:id="#+id/btnLogIn"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:background="#drawable/round_button"
android:text="#string/btn_login"
android:textColor="#color/colorWhite"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintLeft_toLeftOf="#+id/guideline3"
app:layout_constraintRight_toLeftOf="#+id/guideline6"
app:layout_constraintTop_toBottomOf="#+id/progressBar" />
<com.facebook.login.widget.LoginButton
android:id="#+id/btnFacebook"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:paddingBottom="15dp"
android:paddingLeft="15dp"
android:paddingTop="15dp"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintLeft_toLeftOf="#+id/guideline3"
app:layout_constraintRight_toLeftOf="#+id/guideline6"
app:layout_constraintTop_toBottomOf="#+id/btnLogIn" />
<ImageButton
android:id="#+id/btnGoogle"
android:layout_width="0dp"
android:layout_height="50dp"
android:layout_marginTop="8dp"
android:background="#drawable/google_round_button"
android:scaleType="centerInside"
android:src="#drawable/google_button_background"
app:layout_constraintLeft_toLeftOf="#+id/guideline3"
app:layout_constraintRight_toLeftOf="#+id/guideline6"
app:layout_constraintTop_toBottomOf="#+id/btnFacebook" />
<TextView
android:id="#+id/tvRegister"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp"
android:maxLines="2"
android:text="#string/tv_create_account"
android:textAlignment="center"
android:textColor="#color/colorPrimaryDark"
android:textSize="14sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintLeft_toLeftOf="#+id/guideline3"
app:layout_constraintRight_toLeftOf="#+id/guideline6"
app:layout_constraintTop_toBottomOf="#+id/tvForgotPassword" />
<TextView
android:id="#+id/tvForgotPassword"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="#string/tv_forgot_password"
android:textAlignment="center"
android:textColor="#color/colorAccent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintLeft_toLeftOf="#+id/guideline3"
app:layout_constraintRight_toLeftOf="#+id/guideline6"
app:layout_constraintTop_toBottomOf="#+id/btnGoogle" />
</android.support.constraint.ConstraintLayout>
activity_register
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp">
<android.support.constraint.Guideline
android:id="#+id/guideline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.25" />
<android.support.constraint.Guideline
android:id="#+id/guideline4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.15" />
<android.support.constraint.Guideline
android:id="#+id/guideline5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.85" />
<TextView
android:id="#+id/tvLogo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/logo"
android:textSize="50sp"
android:textStyle="bold"
app:layout_constraintBottom_toTopOf="#+id/guideline"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="#+id/tvRegisterLabel"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="3dp"
android:layout_marginLeft="3dp"
android:layout_marginRight="3dp"
android:layout_marginStart="3dp"
android:fontFamily="sans-serif"
android:text="#string/label_register"
android:textAllCaps="true"
android:textSize="20sp"
app:layout_constraintLeft_toLeftOf="#+id/guideline4"
app:layout_constraintRight_toRightOf="#+id/guideline5"
app:layout_constraintTop_toTopOf="#+id/guideline" />
<android.support.design.widget.TextInputLayout
android:id="#+id/textInputLayout"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintLeft_toLeftOf="#+id/guideline4"
app:layout_constraintRight_toRightOf="#+id/guideline5"
app:layout_constraintTop_toBottomOf="#+id/tvRegisterLabel">
<EditText
android:id="#+id/etEmailReg"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusable="true"
android:hint="#string/et_email_hint"
android:inputType="textEmailAddress"
android:maxLength="70"
android:maxLines="1"
android:minLines="1"
android:textSize="#dimen/et_hint_size" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/textInputLayout3"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintLeft_toLeftOf="#+id/guideline4"
app:layout_constraintRight_toRightOf="#+id/guideline5"
app:layout_constraintTop_toBottomOf="#+id/textInputLayout">
<EditText
android:id="#+id/etNameReg"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusable="true"
android:hint="#string/et_name_hint"
android:inputType="textCapWords"
android:maxLength="30"
android:maxLines="1"
android:minLines="1"
android:textSize="#dimen/et_hint_size" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/textInputLayout4"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintLeft_toLeftOf="#+id/guideline4"
app:layout_constraintRight_toRightOf="#+id/guideline5"
app:layout_constraintTop_toBottomOf="#+id/textInputLayout3">
<EditText
android:id="#+id/etPasswordReg"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusable="true"
android:hint="#string/et_password_hint"
android:inputType="textPassword"
android:maxLength="30"
android:maxLines="1"
android:minLines="1"
android:textSize="#dimen/et_hint_size" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/textInputLayout5"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintLeft_toLeftOf="#+id/guideline4"
app:layout_constraintRight_toRightOf="#+id/guideline5"
app:layout_constraintTop_toBottomOf="#+id/textInputLayout4">
<EditText
android:id="#+id/etPasswordConfirmReg"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusable="true"
android:hint="#string/et_password_confirm_hint"
android:inputType="textPassword"
android:maxLength="30"
android:maxLines="1"
android:minLines="1"
android:textSize="#dimen/et_hint_size" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/textInputLayout6"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintLeft_toLeftOf="#+id/guideline4"
app:layout_constraintRight_toRightOf="#+id/guideline5"
app:layout_constraintTop_toBottomOf="#+id/textInputLayout5">
<EditText
android:id="#+id/etPhoneNumber"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusable="true"
android:hint="#string/et_phone_hint"
android:inputType="phone"
android:maxLength="13"
android:maxLines="1"
android:minLines="1"
android:textSize="#dimen/et_hint_size" />
</android.support.design.widget.TextInputLayout>
<TextView
android:id="#+id/tvRequired"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="#string/label_required"
android:textAlignment="textStart"
android:textSize="12sp"
app:layout_constraintLeft_toLeftOf="#+id/guideline4"
app:layout_constraintRight_toRightOf="#+id/guideline5"
app:layout_constraintTop_toBottomOf="#+id/textInputLayout6" />
<Button
android:id="#+id/btnRegister"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="40dp"
android:background="#drawable/round_button"
android:text="#string/label_register"
android:textColor="#android:color/white"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintLeft_toLeftOf="#+id/guideline4"
app:layout_constraintRight_toRightOf="#+id/guideline5"
app:layout_constraintTop_toBottomOf="#+id/tvRequired" />
</android.support.constraint.ConstraintLayout>
So, to clarify my problem: In the activity_login the scrollview works correctly, as expected. While in the activity_register the scrollview doesn't scroll to the bottom, I don't know why, because I've used the same hierarcy as in the activity_login.
I've searched in SO for the same problem, but I haven't found any solution to my problem.
Any help would be appreciated, I'm searching for a solution for days.
I don't know for sure why it's a problem, but the problem seems to be your horizontal Guideline. If I delete the Guideline, delete tvLogo's reference to it, and change tvRegisterLabel's reference to app:layout_constraintTop_toBottomOf="#+id/tvLogo", everything works.
I suspect that it is because you seem to have a circular set of rules in your layout. The ConstraintLayout's height is wrap_content, so it has to lay out all of its views to know how big it is. To lay out its views, it must lay out tvLogo. To lay out tvLogo, it must lay out guideline. To lay out guideline, the ConstraintLayout must know how tall it is. And so on.
By the way, it looks like you could perhaps just replace this ConstraintLayout with a LinearLayout.
Sorry couldn't have much reputations to add comment so giving answer,
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp">
remove padding from this code in activity_register xml, It will solve your problem

Categories

Resources