Android ScrollView Error - IllegalStateException: ScrollView can host only one direct child - android

I have been getting this "ScrollView can host only one direct child" even though I am only using one main layout in the layout XML code. Basically what I'm trying to do is call/start the RegisterFragment from the LoginFragment. I am trying to do that using the following code:
#Override
public void onClick(View view) {
switch (view.getId()) {
case R.id.vvLoginBanner: toggleVolume(); break;
case R.id.btnLogin: login(); break;
case R.id.tvSignup: FragmentManager fragmentManager = getActivity().getSupportFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
fragmentTransaction.replace(R.id.loginFragmentLayout, new RegisterFragment());
fragmentTransaction.addToBackStack(null);
fragmentTransaction.commit();
break;
}
}
Here is the code for both of these XML file that could be possibly causing the error:
LoginFragment.xml
<ScrollView 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"
android:id="#+id/loginFragmentContainer"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:isScrollContainer="true"
tools:context="com.bvmobileapps.bvmobileapps.LoginFragment">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<FrameLayout
android:id="#+id/flBannerProgressBarWrapper"
android:layout_alignParentTop="true"
android:layout_width="match_parent"
android:background="#color/black"
android:layout_height="wrap_content">
<ProgressBar
android:id="#+id/pbBanner"
android:layout_gravity="center"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:indeterminate="true"/>
</FrameLayout>
<androidx.core.widget.NestedScrollView
android:id="#+id/nsvScrollView"
android:layout_below="#id/rlVideoWrapper"
android:isScrollContainer="false"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:id="#+id/loginFragmentLayout"
android:isScrollContainer="true"
android:orientation="vertical"
android:gravity="center"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<FrameLayout
android:id="#+id/fragmentFrameLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<LinearLayout
android:id="#+id/llBannerWrapper"
android:weightSum="100"
android:orientation="horizontal"
android:layout_marginTop="#dimen/inter_item_margin"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<View
android:layout_weight="10"
android:layout_width="0dp"
android:layout_height="1px"/>
<ImageView
android:id="#+id/ivBanner"
android:src="#drawable/bv_banner"
android:layout_weight="80"
android:layout_width="0dp"
android:layout_height="wrap_content" />
</LinearLayout>
<com.google.android.material.textfield.TextInputLayout
android:layout_marginStart="#dimen/inter_item_margin"
android:layout_marginEnd="#dimen/inter_item_margin"
android:layout_marginBottom="#dimen/intra_item_margin"
android:layout_marginTop="#dimen/inter_item_margin"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/tvUsername"
android:hint="#string/username_hint"
android:singleLine="true"
android:maxLength="20"
android:imeOptions="actionNext"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:layout_marginStart="#dimen/inter_item_margin"
android:layout_marginEnd="#dimen/inter_item_margin"
android:layout_marginTop="#dimen/intra_item_margin"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/tvPassword"
android:hint="#string/password_hint"
android:fontFamily="#font/segoe_ui_light"
android:maxLength="20"
android:singleLine="true"
android:imeOptions="actionDone"
android:inputType="textPassword"
android:gravity="start"
android:ellipsize="start"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</com.google.android.material.textfield.TextInputLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal">
<androidx.appcompat.widget.AppCompatButton
android:id="#+id/btnLogin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#color/white"
android:layout_margin="#dimen/inter_item_margin"
android:fontFamily="#font/segoe_ui_semi_bold"
android:text="#string/login_btn"
app:backgroundTint="#color/bv_blue" />
<ProgressBar
android:id="#+id/pbLogin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:visibility="gone" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="-14dp"
android:layout_marginBottom="#dimen/inter_item_margin"
android:gravity="center"
android:orientation="horizontal">
<TextView
android:id="#+id/tvSignup"
android:text="#string/signup"
android:textSize="#dimen/smallest_text"
android:textColor="#color/bv_blue"
android:textAlignment="center"
android:layout_marginRight="20dp"
android:layout_width="150dp"
android:layout_height="wrap_content" />
<TextView
android:id="#+id/tvForgotPassword"
android:text="#string/forgot_password"
android:textSize="#dimen/smallest_text"
android:textColor="#color/bv_blue"
android:textAlignment="center"
android:layout_marginLeft="0dp"
android:layout_width="150dp"
android:layout_height="wrap_content" />
</LinearLayout>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</RelativeLayout>
RegisterFragment.xml
<ScrollView 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"
android:id="#+id/registerFragmentContainer"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:isScrollContainer="true"
tools:context="com.bvmobileapps.bvmobileapps.RegisterFragment">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<FrameLayout
android:id="#+id/flBannerProgressBarWrapper"
android:layout_alignParentTop="true"
android:layout_width="match_parent"
android:background="#color/black"
android:layout_height="wrap_content">
<ProgressBar
android:id="#+id/pbBanner"
android:layout_gravity="center"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:indeterminate="true"/>
</FrameLayout>
<androidx.core.widget.NestedScrollView
android:id="#+id/nsvScrollView"
android:layout_below="#id/rlVideoWrapper"
android:isScrollContainer="false"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:isScrollContainer="true"
android:orientation="vertical"
android:gravity="center"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:id="#+id/registerFragmentLayout"
android:layout_marginStart="#dimen/inter_item_margin"
android:layout_marginEnd="#dimen/inter_item_margin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="0dp"
android:layout_marginBottom="0dp"
android:gravity="center_horizontal"
android:weightSum="10"
android:orientation="horizontal">
<ImageView
android:id="#+id/ivValidUsername"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="21dp"
android:layout_marginBottom="#dimen/intra_item_margin"
android:scaleType="fitXY"
android:src="#drawable/red_error" />
<com.google.android.material.textfield.TextInputLayout
android:layout_marginStart="#dimen/inter_item_margin"
android:layout_marginEnd="#dimen/inter_item_margin"
android:layout_marginBottom="#dimen/intra_item_margin"
android:layout_marginTop="#dimen/inter_item_margin"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/tvUsername"
android:hint="#string/username_hint"
android:singleLine="true"
android:maxLength="20"
android:layout_marginLeft="#dimen/inter_item_margin_left"
android:imeOptions="actionNext"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</com.google.android.material.textfield.TextInputLayout>
</RelativeLayout>
<include layout="#layout/horizontal_divider"
android:id="#+id/source_divider"
android:layout_marginTop="#dimen/intra_item_margin"
android:layout_width="match_parent"
android:layout_height="1dp"
app:layout_constraintTop_toBottomOf="#id/photo_source_edit_text_wrapper"/>
<RelativeLayout
android:layout_marginStart="#dimen/inter_item_margin"
android:layout_marginEnd="#dimen/inter_item_margin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="0dp"
android:layout_marginBottom="0dp"
android:gravity="center_horizontal"
android:weightSum="10"
android:orientation="horizontal">
<ImageView
android:layout_width="50dp"
android:layout_height="50dp"
android:id="#+id/ivValidEmail"
android:layout_gravity="center_horizontal"
android:src="#drawable/red_error"
android:scaleType="fitXY"/>
<com.google.android.material.textfield.TextInputLayout
android:layout_marginStart="#dimen/inter_item_margin"
android:layout_marginEnd="#dimen/inter_item_margin"
android:layout_marginTop="#dimen/intra_item_margin"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/tvEmail"
android:hint="#string/email_hint"
android:fontFamily="#font/segoe_ui_light"
android:maxLength="20"
android:singleLine="true"
android:imeOptions="actionDone"
android:inputType="text"
android:gravity="start"
android:ellipsize="start"
android:layout_marginLeft="#dimen/inter_item_margin_left"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</com.google.android.material.textfield.TextInputLayout>
</RelativeLayout>
<include layout="#layout/horizontal_divider"
android:id="#+id/source_divider"
android:layout_marginTop="#dimen/intra_item_margin"
android:layout_width="match_parent"
android:layout_height="1dp"
app:layout_constraintTop_toBottomOf="#id/photo_source_edit_text_wrapper"/>
<RelativeLayout
android:layout_marginStart="#dimen/inter_item_margin"
android:layout_marginEnd="#dimen/inter_item_margin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="0dp"
android:layout_marginBottom="0dp"
android:gravity="center_horizontal"
android:weightSum="10"
android:orientation="horizontal">
<ImageView
android:layout_width="50dp"
android:layout_height="50dp"
android:id="#+id/ivValidPassword"
android:layout_gravity="center_horizontal"
android:src="#drawable/red_error"
android:scaleType="fitXY"/>
<com.google.android.material.textfield.TextInputLayout
android:layout_marginStart="#dimen/inter_item_margin"
android:layout_marginEnd="#dimen/inter_item_margin"
android:layout_marginTop="#dimen/intra_item_margin"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/tvPassword"
android:hint="#string/password_hint"
android:fontFamily="#font/segoe_ui_light"
android:maxLength="20"
android:singleLine="true"
android:imeOptions="actionDone"
android:inputType="textPassword"
android:gravity="start"
android:ellipsize="start"
android:layout_marginLeft="#dimen/inter_item_margin_left"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</com.google.android.material.textfield.TextInputLayout>
</RelativeLayout>
<include layout="#layout/horizontal_divider"
android:id="#+id/source_divider"
android:layout_marginTop="#dimen/intra_item_margin"
android:layout_width="match_parent"
android:layout_height="1dp"
app:layout_constraintTop_toBottomOf="#id/photo_source_edit_text_wrapper"/>
<LinearLayout
android:layout_marginStart="#dimen/inter_item_margin"
android:layout_marginEnd="#dimen/inter_item_margin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="0dp"
android:layout_marginBottom="0dp"
android:gravity="center_horizontal"
android:weightSum="10"
android:orientation="horizontal">
<com.google.android.material.textfield.TextInputLayout
android:layout_marginTop="#dimen/intra_item_margin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="5">
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/tvFirstName"
android:hint="#string/first_name_hint"
android:fontFamily="#font/segoe_ui_light"
android:maxLength="20"
android:singleLine="true"
android:imeOptions="actionDone"
android:inputType="text"
android:gravity="start"
android:ellipsize="start"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:layout_marginTop="#dimen/intra_item_margin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="5">
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/tvLastName"
android:hint="#string/last_name_hint"
android:fontFamily="#font/segoe_ui_light"
android:maxLength="20"
android:singleLine="true"
android:imeOptions="actionDone"
android:inputType="text"
android:gravity="start"
android:ellipsize="start"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</com.google.android.material.textfield.TextInputLayout>
</LinearLayout>
<com.google.android.material.textfield.TextInputLayout
android:layout_marginStart="#dimen/inter_item_margin"
android:layout_marginEnd="#dimen/inter_item_margin"
android:layout_marginTop="#dimen/intra_item_margin"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Spinner
android:id="#+id/spGender"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="20dp"/>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:layout_marginStart="#dimen/inter_item_margin"
android:layout_marginEnd="#dimen/inter_item_margin"
android:layout_marginTop="#dimen/intra_item_margin"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/tvZipCode"
android:hint="#string/confirm_password_hint"
android:fontFamily="#font/segoe_ui_light"
android:maxLength="20"
android:singleLine="true"
android:imeOptions="actionDone"
android:inputType="textPassword"
android:gravity="start"
android:ellipsize="start"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</com.google.android.material.textfield.TextInputLayout>
<LinearLayout
android:layout_marginStart="#dimen/inter_item_margin"
android:layout_marginEnd="#dimen/inter_item_margin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="0dp"
android:layout_marginBottom="0dp"
android:gravity="center_horizontal"
android:weightSum="25"
android:orientation="horizontal">
<TextView
android:id="#+id/tvBirthDate"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="#dimen/inter_item_margin"
android:layout_marginEnd="#dimen/inter_item_margin"
android:layout_marginTop="#dimen/intra_item_margin"
android:text="DateTime"/>
</LinearLayout>
<include layout="#layout/horizontal_divider"
android:id="#+id/source_divider"
android:layout_marginTop="#dimen/intra_item_margin"
android:layout_width="match_parent"
android:layout_height="1dp"
app:layout_constraintTop_toBottomOf="#id/photo_source_edit_text_wrapper"/>
<com.google.android.material.textfield.TextInputLayout
android:layout_marginStart="#dimen/inter_item_margin"
android:layout_marginEnd="#dimen/inter_item_margin"
android:layout_marginTop="#dimen/intra_item_margin"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/tvSecurityQuestion"
android:hint="#string/secret_question_hint"
android:fontFamily="#font/segoe_ui_light"
android:maxLength="20"
android:singleLine="true"
android:imeOptions="actionDone"
android:inputType="textPassword"
android:gravity="start"
android:ellipsize="start"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:layout_marginStart="#dimen/inter_item_margin"
android:layout_marginEnd="#dimen/inter_item_margin"
android:layout_marginTop="#dimen/intra_item_margin"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/tvSecurityQuestionAnswer"
android:hint="#string/secret_question_answer_hint"
android:fontFamily="#font/segoe_ui_light"
android:maxLength="20"
android:singleLine="true"
android:imeOptions="actionDone"
android:inputType="textPassword"
android:gravity="start"
android:ellipsize="start"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</com.google.android.material.textfield.TextInputLayout>
<CheckBox
android:id="#+id/agree"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/appbar_padding_top"
android:checked="true"
android:text="#string/checkbox_label_termscond" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal">
<androidx.appcompat.widget.AppCompatButton
android:id="#+id/btnRegister"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#color/white"
android:layout_margin="#dimen/inter_item_margin"
android:fontFamily="#font/segoe_ui_semi_bold"
android:text="#string/submit_btn"
app:backgroundTint="#color/bv_blue" />
<ProgressBar
android:id="#+id/pbRegister"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:visibility="gone" />
</RelativeLayout>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</RelativeLayout>
Here is following error message produced in the logcat:
java.lang.IllegalStateException: ScrollView can host only one direct child
at android.widget.ScrollView.addView(ScrollView.java:273)
at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManager.java:1466)
at androidx.fragment.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1784)
at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManager.java:1852)
at androidx.fragment.app.BackStackRecord.executeOps(BackStackRecord.java:802)
at androidx.fragment.app.FragmentManagerImpl.executeOps(FragmentManager.java:2625)
at androidx.fragment.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2411)
at androidx.fragment.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManager.java:2366)
at androidx.fragment.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2273)
at androidx.fragment.app.FragmentManagerImpl$1.run(FragmentManager.java:733)
at android.os.Handler.handleCallback(Handler.java:790)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6651)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:810)
Now I made sure that in the layout I only include one main layout with other nested layouts included in that main layout. So, based on that I don't think I should be getting that error. Any help or advice to fix this problem would be greatly appreciated!

You are missing a closing tag for your Scroll View in your xml files.
Btw, Consider using nested scroll view instead of scroll view.(As mentioned in the documentation)
Also you should avoid using scroll view inside another scroll view.
Suggestion : Avoid nesting too much to enhance layout performance.
Have a look : Performance and view hierarchies

There must be only one child view in ScrollView. You are getting this error because you are not using the full closing tag.
<ScrollView 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"
android:id="#+id/loginFragmentContainer"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:isScrollContainer="true"
tools:context="com.bvmobileapps.bvmobileapps.LoginFragment">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
....
</RelativeLayout>
</ScrollView>

Related

Scrollview not working when focus in EditText on Android studio

I'm confused why it doesn't scroll down when my cursor focus inside the EditText, in order to scroll you just need to click to the another to scroll down, it there any way how to handle this?
I've Already used this command inside Layout but it doesn't work, need help
android:focusable="true"
android:focusableInTouchMode="true"
**The layout above is the child of this activity so this is the parent it's just like onBoarding Screen using ViewPager
The parent xml
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".Scanner.ScanCashCard">
<HorizontalScrollView
android:id="#+id/horizontalScrollView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true" >
<androidx.viewpager.widget.ViewPager
android:id="#+id/viewPager"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</HorizontalScrollView>
<LinearLayout
android:id="#+id/layoutDots"
android:layout_width="match_parent"
android:layout_height="50dp"
android:gravity="center"
android:orientation="horizontal"
android:background="#color/primary"
app:layout_constraintBottom_toBottomOf="parent" />
<TextView
android:id="#+id/tvPrev"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="15dp"
android:layout_marginBottom="25dp"
android:text="PREV"
android:textColor="#android:color/white"
android:textSize="15sp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<TextView
android:id="#+id/tvNext"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="15dp"
android:layout_marginBottom="25dp"
android:text="NEXT"
android:textColor="#android:color/white"
android:textSize="15sp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
<LinearLayout
android:id="#+id/linear2"
android:layout_width="match_parent"
android:layout_height="40dp"
android:orientation="horizontal"
android:padding="5dp"
app:layout_constraintBottom_toBottomOf="parent">
<ImageView
android:id ="#+id/imageIv"
android:height ="60dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
Updated I tried android:fillViewport="true" like in the following but it didn't work
Updated Code
Child xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="#color/primary"
android:focusable="true"
android:focusableInTouchMode="true"
android:orientation="vertical">
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#color/white"
android:layout_margin="15dp"
android:textStyle="bold"
android:text="I. Demographics"
android:fontFamily="sans-serif-condensed"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="15dp" />
<ScrollView
android:background="#color/white"
android:layout_width="wrap_content"
android:layout_height="660dp"
android:fillViewport="true"
>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:layout_marginRight="10dp"
android:focusable="true"
android:focusableInTouchMode="true"
android:orientation="vertical">
<com.google.android.material.textfield.TextInputLayout
android:id="#+id/til_hhid"
style="#style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="30dp"
android:layout_marginRight="10dp"
app:errorEnabled="true"
app:counterEnabled="true"
app:counterMaxLength="30"
app:endIconMode="clear_text"
app:helperText="Search Household ID!"
app:helperTextTextColor="#color/validation"
app:startIconDrawable="#drawable/ic_hh">
<EditText
android:id="#+id/edtHhId"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="160310001-"
android:hint="Household no."
android:inputType="text"
android:maxLength="30" />
</com.google.android.material.textfield.TextInputLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right">
<Button
android:id="#+id/btnSearchHh"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:layout_marginRight="10dp"
android:padding="10dp"
android:textSize="12dp"
android:text="Search"
android:textStyle="bold"
/>
</LinearLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="#+id/til_fullname"
style="#style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/til_search"
android:layout_marginLeft="10dp"
android:layout_marginTop="15dp"
android:layout_marginRight="10dp"
app:endIconMode="clear_text"
app:helperText="Required"
app:helperTextTextColor="#color/validation"
app:startIconDrawable="#drawable/ic_person">
<EditText
android:id="#+id/edtFullname"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Full name:"
android:inputType="text" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="#+id/til_clientstatus"
style="#style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense.ExposedDropdownMenu"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/til_fullname"
android:layout_marginLeft="10dp"
android:layout_marginTop="20dp"
android:layout_marginRight="10dp"
app:helperText="Required"
app:helperTextTextColor="#color/validation"
app:startIconDrawable="#drawable/ic_client">
<androidx.appcompat.widget.AppCompatAutoCompleteTextView
android:id="#+id/spinnerClientStatus"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Client status"
android:inputType="none" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="#+id/til_address"
style="#style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/til_clientstatus"
android:layout_marginLeft="10dp"
android:layout_marginTop="20dp"
android:layout_marginRight="10dp"
app:endIconMode="clear_text"
app:helperText="Required"
app:helperTextTextColor="#color/validation"
app:startIconDrawable="#drawable/ic_baseline_location_on_24">
<EditText
android:id="#+id/edtAddress"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Address"
android:inputType="text" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/til_sex"
app:helperText="Required"
android:layout_marginTop="20dp"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
app:helperTextTextColor="#color/validation"
android:layout_below="#+id/til_address"
app:startIconDrawable="#drawable/ic_baseline_supervised_user_circle_24"
style="#style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense.ExposedDropdownMenu">
<androidx.appcompat.widget.AppCompatAutoCompleteTextView
android:id="#+id/spinnerSex"
android:layout_width= "match_parent"
android:hint="Sex"
android:layout_height="wrap_content"
/>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="#+id/til_contact_no"
style="#style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/til_sex"
android:layout_marginLeft="10dp"
android:layout_marginTop="20dp"
android:layout_marginRight="10dp"
app:endIconMode="clear_text"
app:helperText="Required"
app:helperTextTextColor="#color/validation"
app:startIconDrawable="#drawable/ic_baseline_phone_android_24">
<EditText
android:id="#+id/edtContactNo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Contact No."
android:inputType="number" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="#+id/til_set"
style="#style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/til_contact_no"
android:layout_marginLeft="10dp"
android:layout_marginTop="20dp"
android:layout_marginRight="10dp"
app:endIconMode="clear_text"
app:helperText="Required"
app:helperTextTextColor="#color/validation"
app:startIconDrawable="#drawable/ic_assigned">
<EditText
android:id="#+id/edtSet"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Set"
android:inputType="number" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="#+id/til_assigned"
style="#style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/til_contact_no"
android:layout_marginLeft="10dp"
android:layout_marginTop="20dp"
android:layout_marginRight="10dp"
app:endIconMode="clear_text"
app:helperTextTextColor="#color/validation"
app:startIconDrawable="#drawable/ic_baseline_person_24">
<EditText
android:id="#+id/edtAssigned"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Assigned C/ML"
android:inputType="text" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/til_minor_grantee"
android:layout_marginTop="20dp"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
android:layout_marginBottom="80dp"
app:helperTextTextColor="#color/validation"
android:layout_below="#+id/til_assigned"
app:startIconDrawable="#drawable/ic_baseline_escalator_warning_24"
style="#style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense.ExposedDropdownMenu">
<androidx.appcompat.widget.AppCompatAutoCompleteTextView
android:id="#+id/spinnerMinorGrantee"
android:layout_width= "match_parent"
android:hint="Minor Grantee"
android:layout_height="wrap_content"
/>
</com.google.android.material.textfield.TextInputLayout>
</LinearLayout>
</RelativeLayout>
</ScrollView>
</LinearLayout>
Change the height of the ScrollView like this.
And Also add app:layout_constraintTop_toBottomOf and app:layout_constraintBottom_toBottomOf.
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintTop_toBottomOf="#+id/textView1"
app:layout_constraintBottom_toBottomOf="parent">
If first doesn't work, try second one.
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:animateLayoutChanges="true"
android:fillViewport="true">
May be this will fix your issue.

TextInputEditText with adjustPan - can't see entered text

I'm playing with TextInputEditText and I'm front face a strange issue. When I edit the content of the first one, let's say the "Nom" field, everything looks good, the keyboard appears and I can see the entered text. Now if I need to enter a text in a text field which is under the keyboard, the Activity pans up so the field is in view, but I can NOT see the text that I'm entering... Please have a look at this video: https://www.digitalblend.fr/android_TextInputEditText_issue.mp4
Moreover please have a look at my actual code :
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/scrollView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fillViewport="true"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context=".MessageFragment">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:layout_marginTop="30dp"
android:orientation="vertical">
<View
android:layout_width="match_parent"
android:layout_height="120dp" />
<LinearLayout
android:layout_height="match_parent"
android:layout_width="match_parent"
android:layout_marginTop="20dp"
android:orientation="horizontal">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical" >
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#color/black"
android:textStyle="bold"
android:text="#string/required_last_name"/>
<com.google.android.material.textfield.TextInputLayout
style="#style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/lastname"
android:layout_width="match_parent"
android:padding="5dp"
android:maxLines="1"
android:hint=""
android:inputType="textPersonName"
android:nextFocusDown="#+id/firstname"
android:layout_height="wrap_content"/>
</com.google.android.material.textfield.TextInputLayout>
</LinearLayout>
<View
android:layout_width="10dp"
android:layout_height="0dp"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#color/black"
android:textStyle="bold"
android:text="#string/first_name"/>
<com.google.android.material.textfield.TextInputLayout
style="#style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/firstname"
android:layout_width="match_parent"
android:padding="5dp"
android:hint=""
android:maxLines="1"
android:inputType="textPersonName"
app:textInputLayoutFocusedRectEnabled="true"
android:layout_height="wrap_content"/>
</com.google.android.material.textfield.TextInputLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#color/black"
android:textStyle="bold"
android:text="#string/required_mail"/>
<com.google.android.material.textfield.TextInputLayout
style="#style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/email"
android:layout_width="match_parent"
android:padding="5dp"
android:hint=""
android:maxLines="1"
android:inputType="textEmailAddress"
android:layout_height="wrap_content"/>
</com.google.android.material.textfield.TextInputLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#color/black"
android:textStyle="bold"
android:text="#string/required_enterprise"/>
<com.google.android.material.textfield.TextInputLayout
style="#style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/enterprise"
android:layout_width="match_parent"
android:padding="5dp"
android:maxLines="1"
android:hint=""
android:inputType="text"
android:layout_height="wrap_content"/>
</com.google.android.material.textfield.TextInputLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#color/black"
android:textStyle="bold"
android:text="#string/required_code_postal"/>
<com.google.android.material.textfield.TextInputLayout
style="#style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/postal_code"
android:layout_width="match_parent"
android:padding="5dp"
android:maxLines="1"
android:hint=""
android:inputType="text"
android:layout_height="wrap_content"/>
</com.google.android.material.textfield.TextInputLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#color/black"
android:textStyle="bold"
android:text="#string/city"/>
<com.google.android.material.textfield.TextInputLayout
style="#style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/city"
android:layout_width="match_parent"
android:padding="5dp"
android:maxLines="1"
android:hint=""
android:inputType="text"
android:layout_height="wrap_content"/>
</com.google.android.material.textfield.TextInputLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/phone_number_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#color/black"
android:textStyle="bold"
android:text="#string/required_tel"/>
<com.google.android.material.textfield.TextInputLayout
style="#style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:background="#android:color/transparent"
android:layout_height="wrap_content">
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/phone_number"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingVertical="5dp"
android:paddingHorizontal="15dp"
android:maxLines="1"
android:inputType="text"
android:textColor="#color/black"
android:imeOptions="actionDone"/>
</com.google.android.material.textfield.TextInputLayout>
</LinearLayout>
</LinearLayout>
<androidx.appcompat.widget.AppCompatButton
android:id="#+id/btn_buy"
android:layout_width="match_parent"
android:layout_height="50dp"
android:scaleType="fitCenter"
android:background="#drawable/little_red_button"
android:layout_marginStart="15dp"
android:layout_marginEnd="15dp"
android:layout_marginTop="20dp"
android:text="#string/send_demand"
android:gravity="center"
android:textColor="#color/white"
android:textSize="14sp"/>
</LinearLayout>
</ScrollView>
In my manifest I used android:windowSoftInputMode="adjustPan">
If someone has an idea ? Thanks in advance.

Bottom Navigation and Fragment is overlapping

As you can see in this picture
the bottom navigation and the textfields are over lapping.
what could be the cause of this weird behavior of my app?
here is the xml:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context=".fragment.ApplicationFragment">
<androidx.core.widget.NestedScrollView
android:id="#+id/scroll_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:paddingLeft="5dp"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:baselineAligned="false">
<RelativeLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1">
<com.google.android.material.textfield.TextInputLayout
android:id="#+id/text_amount_applied"
style="#style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
app:errorEnabled="true">
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/amount_edit_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxLines="1"
android:inputType="numberDecimal"
android:hint="Amount Applied" />
</com.google.android.material.textfield.TextInputLayout>
</RelativeLayout>
<RelativeLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1">
<com.google.android.material.textfield.TextInputLayout
style="#style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:hint="Mode of payment">
<AutoCompleteTextView
android:id="#+id/filled_exposed_dropdown"
android:layout_width="match_parent"
android:maxLines="1"
android:editable="false"
android:layout_height="wrap_content"/>
</com.google.android.material.textfield.TextInputLayout>
</RelativeLayout>
<RelativeLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1">
<com.google.android.material.textfield.TextInputLayout
android:id="#+id/text_term"
style="#style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
app:errorEnabled="true">
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/term_edit_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxLines="1"
android:inputType="number"
android:hint="Term" />
</com.google.android.material.textfield.TextInputLayout>
</RelativeLayout>
</LinearLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="INDIVIDUAL INFORMATION"
android:textSize="20dp"
android:layout_marginBottom="10dp"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:baselineAligned="false">
<RelativeLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1">
<com.google.android.material.textfield.TextInputLayout
android:id="#+id/text_last_name"
style="#style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
app:errorEnabled="true">
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/lastname_edit_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxLines="1"
android:hint="Lastname" />
</com.google.android.material.textfield.TextInputLayout>
</RelativeLayout>
<RelativeLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1">
<com.google.android.material.textfield.TextInputLayout
android:id="#+id/text_first_name"
style="#style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
app:errorEnabled="true">
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/firstname_edit_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxLines="1"
android:hint="Firstname" />
</com.google.android.material.textfield.TextInputLayout>
</RelativeLayout>
<RelativeLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1">
<com.google.android.material.textfield.TextInputLayout
android:id="#+id/text_middle_name"
style="#style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
app:errorEnabled="true">
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/middlename_edit_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxLines="1"
android:hint="Middlename" />
</com.google.android.material.textfield.TextInputLayout>
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:baselineAligned="false">
<RelativeLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1">
<com.google.android.material.textfield.TextInputLayout
android:id="#+id/text_birthdate"
style="#style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
app:errorEnabled="true">
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/birthdate_edit_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxLines="1"
android:editable="false"
android:inputType="date"
android:hint="Birthdate" />
</com.google.android.material.textfield.TextInputLayout>
</RelativeLayout>
<RelativeLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1">
<com.google.android.material.textfield.TextInputLayout
android:id="#+id/text_age"
style="#style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
app:errorEnabled="true">
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/age_edit_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxLines="1"
android:inputType="number"
android:hint="Age" />
</com.google.android.material.textfield.TextInputLayout>
</RelativeLayout>
<RelativeLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1">
<com.google.android.material.textfield.TextInputLayout
style="#style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:hint="Sex">
<AutoCompleteTextView
android:id="#+id/sex_exposed_dropdown"
android:layout_width="match_parent"
android:maxLines="1"
android:editable="false"
android:layout_height="wrap_content"/>
</com.google.android.material.textfield.TextInputLayout>
</RelativeLayout>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</FrameLayout>
and this is the activity_main.xml
<com.google.android.material.circularreveal.coordinatorlayout.CircularRevealCoordinatorLayout
android:id="#+id/frame_container"
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">
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="#+id/bottom_navigation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="?android:attr/windowBackground"
app:itemBackground="#color/colorPrimary"
android:foreground="?attr/selectableItemBackground"
app:itemIconTint="#android:color/white"
app:itemTextColor="#android:color/white"
app:menu="#menu/bottom_nav_menu" />
</com.google.android.material.circularreveal.coordinatorlayout.CircularRevealCoordinatorLayout>
by the way I just duplicated, copy and pasted 10 or mor times the Birthdate, Age and sex in order to test if the fragment is scrolling. eventually after I run the app as you can see in the picture the bottom navigation and the text fields are now overlapping.
let's suppose your BottomNavigationView height is 60dp , you can avoid this behavior by adding this attribut to your NestedScrollView
android:layout_marginBottom="60dp"

Scroll view making the reason to crash

My application getting crash by throughing below errors for scrollview, even childs are grouped in parent view. this is happening only when internet is off, otherwise it's working.
02-22 14:26:20.504 13277-13277/com.eonelectric.eon E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.eonelectric.eon, PID: 13277
java.lang.IllegalStateException: ScrollView can host only one direct child
at android.widget.ScrollView.addView(ScrollView.java:248)
at android.support.design.widget.Snackbar.showView(Snackbar.java:483)
at android.support.design.widget.Snackbar$1.handleMessage(Snackbar.java:167)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5343)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:905)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:700)
My layout file is here.
<?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"
xmlns:tools="http://schemas.android.com/tools"
android:fillViewport="true">
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/main_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<ImageView
android:id="#+id/loginBackgroundIv"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitXY"
android:src="#drawable/login_bg"
tools:ignore="ContentDescription"/>
<de.hdodenhof.circleimageview.CircleImageView xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/profilePicIv"
android:layout_width="135dp"
android:layout_height="110dp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="16dp"
android:scaleType="centerCrop"
android:src="#drawable/user"
app:civ_border_color="#fff"
app:civ_border_width="2dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="130dp"
android:orientation="vertical">
<android.support.design.widget.TextInputLayout
android:id="#+id/nameWraper"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.design.widget.TextInputEditText
android:id="#+id/nameEt"
style="#style/custom_et"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPersonName"
android:singleLine="true"
android:textColor="#ffffff" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/phoneWrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.design.widget.TextInputEditText
android:id="#+id/phoneEt"
style="#style/custom_et"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="number"
android:maxLength="10"
android:singleLine="true" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/emailWrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.design.widget.TextInputEditText
android:id="#+id/emailEt"
style="#style/custom_et"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true" />
</android.support.design.widget.TextInputLayout>
<LinearLayout
android:id="#+id/pwdLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<android.support.design.widget.TextInputLayout
android:id="#+id/pwdwrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.design.widget.TextInputEditText
android:id="#+id/pwdEt"
style="#style/custom_et"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textWebPassword"
android:singleLine="true" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/repwdwrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.design.widget.TextInputEditText
android:id="#+id/repwdEt"
style="#style/custom_et"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textWebPassword"
android:singleLine="true" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>
<!--<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
android:weightSum="100">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="40"
android:padding="8dp"
android:text="User type ?"
android:textColor="#android:color/white"
android:textSize="16sp" />
<Spinner
android:id="#+id/userTypeSpinner"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="60"
android:entries="#array/userTypeArray" />
</LinearLayout>-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
android:weightSum="100">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="40"
android:padding="8dp"
android:text="State ?"
android:textColor="#android:color/white"
android:textSize="16sp" />
<Spinner
android:id="#+id/stateSpinner"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="60" />
</LinearLayout>
<LinearLayout
android:id="#+id/empLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:visibility="visible">
<android.support.design.widget.TextInputLayout
android:id="#+id/empCodeWrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.design.widget.TextInputEditText
android:id="#+id/empCodeEt"
style="#style/custom_et"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true" />
</android.support.design.widget.TextInputLayout>
<!--<android.support.design.widget.TextInputLayout
android:id="#+id/empDivCodeWrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="#+id/empDivCodeEt"
style="#style/custom_et"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true" />
</android.support.design.widget.TextInputLayout>-->
</LinearLayout>
<Button
android:id="#+id/finishSignupBtn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="Sign Up"
android:textColor="#android:color/white" />
</LinearLayout>
</FrameLayout>
</ScrollView>
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout android:layout_width="match_parent"
android:layout_height="match_parent"
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"
android:fillViewport="true">
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/main_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<ImageView
android:id="#+id/loginBackgroundIv"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitXY"
tools:ignore="ContentDescription"/>
<de.hdodenhof.circleimageview.CircleImageView xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/profilePicIv"
android:layout_width="135dp"
android:layout_height="110dp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="16dp"
android:scaleType="centerCrop"
app:civ_border_color="#fff"
app:civ_border_width="2dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="130dp"
android:orientation="vertical">
<android.support.design.widget.TextInputLayout
android:id="#+id/nameWraper"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.design.widget.TextInputEditText
android:id="#+id/nameEt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPersonName"
android:singleLine="true"
android:textColor="#ffffff" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/phoneWrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.design.widget.TextInputEditText
android:id="#+id/phoneEt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="number"
android:maxLength="10"
android:singleLine="true" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/emailWrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.design.widget.TextInputEditText
android:id="#+id/emailEt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true" />
</android.support.design.widget.TextInputLayout>
<LinearLayout
android:id="#+id/pwdLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<android.support.design.widget.TextInputLayout
android:id="#+id/pwdwrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.design.widget.TextInputEditText
android:id="#+id/pwdEt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textWebPassword"
android:singleLine="true" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/repwdwrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.design.widget.TextInputEditText
android:id="#+id/repwdEt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textWebPassword"
android:singleLine="true" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>
<!--<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
android:weightSum="100">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="40"
android:padding="8dp"
android:text="User type ?"
android:textColor="#android:color/white"
android:textSize="16sp" />
<Spinner
android:id="#+id/userTypeSpinner"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="60"
android:entries="#array/userTypeArray" />
</LinearLayout>-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
android:weightSum="100">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="40"
android:padding="8dp"
android:text="State ?"
android:textColor="#android:color/white"
android:textSize="16sp" />
<Spinner
android:id="#+id/stateSpinner"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="60" />
</LinearLayout>
<LinearLayout
android:id="#+id/empLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:visibility="visible">
<android.support.design.widget.TextInputLayout
android:id="#+id/empCodeWrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.design.widget.TextInputEditText
android:id="#+id/empCodeEt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true" />
</android.support.design.widget.TextInputLayout>
<!--<android.support.design.widget.TextInputLayout
android:id="#+id/empDivCodeWrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="#+id/empDivCodeEt"
style="#style/custom_et"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true" />
</android.support.design.widget.TextInputLayout>-->
</LinearLayout>
<Button
android:id="#+id/finishSignupBtn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="Sign Up"
android:textColor="#android:color/white" />
</LinearLayout>
</FrameLayout>
ScrollView can have only one child view. Make a LinearLayout inside ScrollView to wrap all of child view. Like -
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/main_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ImageView
android:id="#+id/loginBackgroundIv"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitXY"
android:src="#drawable/login_bg"
tools:ignore="ContentDescription"/>
<de.hdodenhof.circleimageview.CircleImageView xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/profilePicIv"
android:layout_width="135dp"
android:layout_height="110dp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="16dp"
android:scaleType="centerCrop"
android:src="#drawable/user"
app:civ_border_color="#fff"
app:civ_border_width="2dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="130dp"
android:orientation="vertical">
<android.support.design.widget.TextInputLayout
android:id="#+id/nameWraper"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.design.widget.TextInputEditText
android:id="#+id/nameEt"
style="#style/custom_et"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPersonName"
android:singleLine="true"
android:textColor="#ffffff" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/phoneWrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.design.widget.TextInputEditText
android:id="#+id/phoneEt"
style="#style/custom_et"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="number"
android:maxLength="10"
android:singleLine="true" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/emailWrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.design.widget.TextInputEditText
android:id="#+id/emailEt"
style="#style/custom_et"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true" />
</android.support.design.widget.TextInputLayout>
<LinearLayout
android:id="#+id/pwdLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<android.support.design.widget.TextInputLayout
android:id="#+id/pwdwrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.design.widget.TextInputEditText
android:id="#+id/pwdEt"
style="#style/custom_et"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textWebPassword"
android:singleLine="true" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/repwdwrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.design.widget.TextInputEditText
android:id="#+id/repwdEt"
style="#style/custom_et"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textWebPassword"
android:singleLine="true" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>
<!--<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
android:weightSum="100">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="40"
android:padding="8dp"
android:text="User type ?"
android:textColor="#android:color/white"
android:textSize="16sp" />
<Spinner
android:id="#+id/userTypeSpinner"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="60"
android:entries="#array/userTypeArray" />
</LinearLayout>-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
android:weightSum="100">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="40"
android:padding="8dp"
android:text="State ?"
android:textColor="#android:color/white"
android:textSize="16sp" />
<Spinner
android:id="#+id/stateSpinner"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="60" />
</LinearLayout>
<LinearLayout
android:id="#+id/empLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:visibility="visible">
<android.support.design.widget.TextInputLayout
android:id="#+id/empCodeWrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.design.widget.TextInputEditText
android:id="#+id/empCodeEt"
style="#style/custom_et"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true" />
</android.support.design.widget.TextInputLayout>
<!--<android.support.design.widget.TextInputLayout
android:id="#+id/empDivCodeWrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="#+id/empDivCodeEt"
style="#style/custom_et"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true" />
</android.support.design.widget.TextInputLayout>-->
</LinearLayout>
<Button
android:id="#+id/finishSignupBtn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="Sign Up"
android:textColor="#android:color/white" />
</LinearLayout>
</LinearLayout>
</ScrollView>
</FrameLayout>

TextInputLayout inside the scrollview

I am using TextInputLayout inside the scrollview , when i come to the app then the view is visible fine but when i start scrollview then the view start scrollview but original view is also shown below it. I am attaching the snapshot please let me know the problem.
when i come to the app it looks like this :
and when i start scrolling it looks like this :
Here is my code:
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background = "#android:color/transparent"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:id="#+id/attch_photo_ll"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_margin="5dp"
android:background="#CBCFD3"
>
<Button
android:id="#+id/attach_photo_btn"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#null"
android:textStyle="bold"
android:textSize="#dimen/_13sdp"
android:inputType="textNoSuggestions"
android:paddingLeft="10dp"
android:textColor="#android:color/white"
android:text="Attach Photo"
/>
</LinearLayout>
<LinearLayout
android:id="#+id/photo_ll"
android:visibility="gone"
android:layout_width="#dimen/image_width"
android:layout_height="#dimen/image_height"
android:layout_margin="5dp"
android:layout_gravity="center"
android:gravity="center">
<ImageView
android:id="#+id/photo_img"
android:adjustViewBounds="true"
android:layout_width="#dimen/image_width"
android:layout_height="#dimen/image_height"
android:scaleType="fitXY"/>
</LinearLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/input_layout_username"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="#+id/firstName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="First Name" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/input_layout_lastName"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="#+id/lastName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Last Name" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/input_layout_mobile_one"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="#+id/mobile_one"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Mobile 1" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/input_layout_mobile_two"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="#+id/mobile_two"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Mobile 2 (Optional)" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/input_layout_email"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="#+id/email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Email" />
</android.support.design.widget.TextInputLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="#dimen/_8sdp"
android:orientation="horizontal"
android:weightSum="3">
<android.support.design.widget.TextInputLayout
android:layout_weight="1"
android:id="#+id/input_layout_aadhar_card"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="#+id/aadhar_card"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Aadhar No." />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_weight="1"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="#+id/aadhar_card1"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_weight="1"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="#+id/aadhar_card2"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</android.support.design.widget.TextInputLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="#dimen/_8sdp"
android:layout_marginBottom="#dimen/_8sdp"
android:orientation="horizontal"
android:weightSum="3">
<android.support.design.widget.TextInputLayout
android:id="#+id/input_layout_pancard"
android:layout_weight="1"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="#+id/pancard"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Pan Card No."/>
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/input_layout_pancard1"
android:layout_weight="1"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="#+id/pancard1"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/input_layout_pancard2"
android:layout_weight="1"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="#+id/pancard2"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</android.support.design.widget.TextInputLayout>
</LinearLayout>
</LinearLayout>
</ScrollView>
Try this.
Remove the hint from the EditText and add the hint to TextInputLayout in your layout
For e.g
<android.support.design.widget.TextInputLayout
android:id="#+id/input_layout_username"
android:layout_width="match_parent"
android:hint="First Name"
android:layout_height="wrap_content">
<EditText
android:id="#+id/firstName"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</android.support.design.widget.TextInputLayout>
please copy and paste following layout file with your existing your problem was solved:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#android:color/transparent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:id="#+id/attch_photo_ll"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_margin="5dp"
android:background="#CBCFD3">
<Button
android:id="#+id/attach_photo_btn"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#null"
android:inputType="textNoSuggestions"
android:paddingLeft="10dp"
android:text="Attach Photo"
android:textColor="#android:color/white"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:id="#+id/photo_ll"
android:layout_width="#dimen/image_width"
android:layout_height="#dimen/image_height"
android:layout_gravity="center"
android:layout_margin="5dp"
android:gravity="center"
android:visibility="gone">
<ImageView
android:id="#+id/photo_img"
android:layout_width="#dimen/image_width"
android:layout_height="#dimen/image_height"
android:adjustViewBounds="true"
android:scaleType="fitXY" />
</LinearLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/input_layout_username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="First Name">
<EditText
android:id="#+id/firstName"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/input_layout_lastName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Last Name">
<EditText
android:id="#+id/lastName"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/input_layout_mobile_one"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Mobile 1">
<EditText
android:id="#+id/mobile_one"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/input_layout_mobile_two"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Mobile 2 (Optional)">
<EditText
android:id="#+id/mobile_two"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/input_layout_email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Email">
<EditText
android:id="#+id/email"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</android.support.design.widget.TextInputLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:orientation="horizontal"
android:weightSum="3">
<android.support.design.widget.TextInputLayout
android:id="#+id/input_layout_aadhar_card"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:hint="Aadhar No.">
<EditText
android:id="#+id/aadhar_card"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1">
<EditText
android:id="#+id/aadhar_card1"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1">
<EditText
android:id="#+id/aadhar_card2"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:orientation="horizontal"
android:weightSum="3">
<android.support.design.widget.TextInputLayout
android:id="#+id/input_layout_pancard"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:hint="Pan Card No.">
<EditText
android:id="#+id/pancard"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/input_layout_pancard1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1">
<EditText
android:id="#+id/pancard1"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/input_layout_pancard2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1">
<EditText
android:id="#+id/pancard2"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>
</LinearLayout>

Categories

Resources