editext not getting focus constraint layout - android

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.

Related

ScrollView Overlaps content in fragment

In this fragment as soon as try to scroll the contents start overlapping on each other.
This fragment opens immediately after a Splash Screen Activity. when I try to input something in first edit text and then scroll at that time all the things overlap on each other. The overlapping takes place only when I try to scroll. Please Help
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
android:id="#+id/scrollView_login"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context=".LoginFragment"
android:layout_height="match_parent"
android:layout_width="match_parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="#+id/layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/textView3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/MarginTop"
android:text="#string/app_name"
android:textAlignment="center"
android:textAppearance="#style/TextAppearance.AppCompat.Large"
android:textSize="30sp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="#+id/imageView"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_marginTop="20dp"
android:src="#drawable/ic_launch"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/textView3" />
<TextView
android:id="#+id/tagline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="#string/tagline"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/imageView" />
<TextView
android:id="#+id/login"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="32dp"
android:text="#string/Candidate_login"
android:textColor="#000000"
android:textSize="18dp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/tagline" />
<TextView
android:id="#+id/email"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="56dp"
android:layout_marginTop="24dp"
android:text="#string/email"
android:textColor="#000000"
android:textSize="16dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/login" />
<EditText
android:id="#+id/emailmobile"
android:layout_width="300dp"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:background="#color/White"
android:hint="Enter Email"
android:inputType="textEmailAddress"
android:padding="5dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/email" />
<TextView
android:id="#+id/password"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="56dp"
android:layout_marginTop="24dp"
android:text="#string/pass"
android:textColor="#000000"
android:textSize="16dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/emailmobile" />
<EditText
android:id="#+id/passedit"
android:layout_width="300dp"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:background="#color/White"
android:hint="#string/pass"
android:inputType="textPassword"
android:padding="5dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.504"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/password" />
<Button
android:id="#+id/log_in"
android:layout_width="300dp"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:background="#color/colorPrimaryDark"
android:padding="5dp"
android:text="#string/login"
android:textColor="#color/White"
android:textSize="18dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/passedit" />
<TextView
android:id="#+id/textView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="18dp"
android:text="#string/forget_pass"
android:textColor="#color/colorPrimaryDark"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/log_in" />
<LinearLayout
android:id="#+id/sign"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="13dp"
android:gravity="center_horizontal"
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/textView6">
<TextView
android:id="#+id/textView7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/NoAccount" />
<TextView
android:id="#+id/textViewSignUp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="3dp"
android:text="#string/signup"
android:textColor="#color/colorPrimaryDark" />
</LinearLayout>
</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

TextInpuLayout Stroke is not showing correctly

I am using InputEditTextLayout Outline Dense.
The stroke is cut out like this when hint enabled= off but shown correctly when hint is enabled.
https://ibb.co/yPrjHJ2
https://ibb.co/WD8Lktc
I tried putting padding and margins but nothing works. I couldn't find how to set padding for background in InputEditTextLayout.
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<ImageView
android:id="#+id/imageView2"
android:layout_width="match_parent"
android:layout_height="120dp"
android:layout_marginTop="124dp"
android:minHeight="10dp"
android:paddingBottom="16dp"
android:src="#drawable/signin_header"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<com.google.android.material.textfield.TextInputLayout
android:id="#+id/textInputLayout2"
style="#style/LoginTextInputLayoutStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:hintEnabled="false"
android:layout_marginTop="16dp"
app:layout_constraintEnd_toStartOf="#+id/guideline2"
app:layout_constraintHorizontal_bias="0.0"
android:paddingBottom="4dp"
android:paddingTop="2dp"
app:layout_constraintStart_toStartOf="#+id/guideline3"
app:layout_constraintTop_toBottomOf="#+id/imageView2">
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/login_email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Email"
android:paddingStart="16dp"
android:layout_gravity="center"
android:inputType="textEmailAddress"
android:textColor="#color/LightBlack"
android:textColorHint="#color/LightBlack"
android:textSize="16dp" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="#+id/textInputLayout"
style="#style/LoginTextInputLayoutStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginVertical="#dimen/tex_size_default"
android:layout_marginTop="32dp"
app:hintEnabled="false"
android:paddingBottom="2dp"
android:paddingTop="2dp"
app:layout_constraintEnd_toStartOf="#+id/guideline2"
app:layout_constraintStart_toStartOf="#+id/guideline3"
app:layout_constraintTop_toBottomOf="#+id/textInputLayout2"
app:passwordToggleEnabled="true">
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/login_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Enter Password"
android:inputType="textPassword"
android:paddingStart="16dp"
android:textColorHint="#color/LightBlack"
android:textColor="#color/LightBlack"
android:textSize="16sp" />
</com.google.android.material.textfield.TextInputLayout>
<TextView
android:id="#+id/not_regis"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:paddingEnd="5dp"
android:text="Not registered?"
android:textAlignment="center"
android:textColor="#android:color/white"
android:textSize="#dimen/tex_size_default"
app:layout_constraintStart_toStartOf="#+id/textView13"
app:layout_constraintTop_toBottomOf="#+id/textView13" />
<TextView
android:id="#+id/login_signup"
style="#style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="wrap_content"
android:layout_height="26dp"
android:layout_toEndOf="#+id/not_regis"
android:onClick="signup_screen"
android:text="Sign Up"
android:textAlignment="center"
android:textColor="#F57C00"
android:textSize="#dimen/tex_size_default"
android:textStyle="bold"
app:layout_constraintBaseline_toBaselineOf="#+id/not_regis"
app:layout_constraintStart_toEndOf="#+id/not_regis" />
<com.google.android.material.button.MaterialButton
android:id="#+id/login_login"
style="#style/RoundButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginStart="92dp"
android:layout_marginTop="32dp"
android:onClick="login"
android:padding="10dp"
android:text="LOGIN"
android:textColor="#android:color/black"
app:layout_constraintStart_toStartOf="#+id/guideline3"
app:layout_constraintTop_toBottomOf="#+id/textInputLayout" />
<TextView
android:id="#+id/textView13"
android:layout_width="137dp"
android:layout_height="23dp"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:layout_marginStart="8dp"
android:layout_marginTop="40dp"
android:onClick="forgetpassword"
android:text="Forgot password"
android:textColor="#F57C00"
android:textSize="#dimen/tex_size_default"
app:layout_constraintStart_toStartOf="#+id/guideline3"
app:layout_constraintTop_toBottomOf="#+id/login_login" />
<androidx.constraintlayout.widget.Guideline
android:id="#+id/guideline2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.84" />
<androidx.constraintlayout.widget.Guideline
android:id="#+id/guideline3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.16" />
</androidx.constraintlayout.widget.ConstraintLayout>
You can try below sample one to showing correctly TextInpuLayout Stroke. You can also refer them for a more complete solution.
<TextView
android:id="#+id/not_regis"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:paddingEnd="5dp"
android:text="Not registered?"
android:textAlignment="center"
android:textColor="#android:color/white"
android:textSize="#dimen/tex_size_default"
app:layout_constraintStart_toStartOf="#+id/textView13"
app:layout_constraintTop_toBottomOf="#+id/textView13" />
Try this one example which I have used.
<com.google.android.material.textfield.TextInputLayout
android:id="#+id/user_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="42dp"
android:layout_marginTop="87dp"
android:layout_marginEnd="42dp"
android:theme="#style/TextLabel"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#id/tv_bold_line">
<androidx.appcompat.widget.AppCompatAutoCompleteTextView
android:id="#+id/ed_user_name"
style="#style/TextViewSingleLine"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:drawableEndCompat="#drawable/ic_user"
android:hint="#string/user_name"
android:imeOptions="actionNext"
android:paddingBottom="16dp"
android:textSize="#dimen/login_text" />
</com.google.android.material.textfield.TextInputLayout>

None of the edit text is not getting focused whenever i click it

I have created an xml that includes some edit text, calendar. I am having an issue that when ever I touch the edit text the cursor is not getting focused.I have tried android:focusable=true in xml and also in java.but its not working.I cant type the values in edit text.Here is my 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"
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 is the image of edit text
Use
android:textCursorDrawable
Reference to a drawable that will be drawn under the insertion cursor.
<EditText
......
android:textCursorDrawable="#null"
android:focusableInTouchMode="true"
Try 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">
<ScrollView
android:id="#+id/svScroll"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
android:padding="10dp"
android:scrollbars="none"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintBottom_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">
<android.support.constraint.ConstraintLayout
android:id="#+id/constraint_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<EditText
android:id="#+id/etEmailid"
android:layout_width="match_parent"
android:layout_height="48dp"
android:hint="email_txt"
android:inputType="text"
android:padding="10dp"
android:textSize="16sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<EditText
android:id="#+id/etFirstName"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginTop="10dp"
android:hint="First_name"
android:inputType="textCapWords"
android:padding="10dp"
android:textSize="16sp"
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:hint="last_name"
android:inputType="textCapWords"
android:padding="10dp"
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:drawablePadding="10dp"
android:gravity="center_vertical"
android:hint="dob"
android:padding="10dp"
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: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:hint="mobile_txt"
android:inputType="number"
android:padding="10dp"
android:textSize="16sp"
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:hint="address"
android:inputType="textCapWords"
android:padding="10dp"
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:hint="S_city"
android:inputType="textCapWords"
android:padding="10dp"
android:textSize="16sp"
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:hint="pincode"
android:inputType="number"
android:padding="10dp"
android:textSize="16sp"
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:gravity="right"
android:textSize="10sp"
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/kid_goku"
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:gravity="center|left"
android:text="CHOOSE YOUR PHOTO"
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"
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:layout_marginBottom="10dp"
android:layout_marginLeft="40dp"
android:layout_marginRight="40dp"
android:text="UPDATE"
app:layout_constraintBottom_toBottomOf="parent" />
</android.support.constraint.ConstraintLayout>

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