Bottom Navigation and Fragment is overlapping - android

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"

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.

Text View and Image view not showing in android studio layout when I use a custom toolbar with its theme set using the materials library

I made an android activity in which I had a custom toolbar (which had theme set to one of the themes of the material library) .However , I am facing serious issues as when I try to add an image view and a text view to my layout , I cannot see them in my layout and on running the app,the app crashes . Can someone recommend a solution to this problem?
Here is the snapshot of my code along with the layout
Here is the XML code
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".AddHappyPlace">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.appbar.MaterialToolbar
android:id="#+id/toolbarAdd"
android:layout_width="match_parent"
android:background="#color/newColorPrimaryDark"
android:theme="#style/CustomNoActionBarTheme"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
android:layout_height="?attr/actionBarSize" />
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
style="#style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_marginTop="20dp"
android:layout_height="wrap_content">
<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent" android:id="#+id/etTitle"
android:hint="Title" android:textColorHint="#d3d3d3"
android:layout_height="wrap_content"/>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
style="#style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_marginTop="15dp"
android:layout_height="wrap_content">
<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:id="#+id/etDetails"
android:hint="Details"
android:textColorHint="#d3d3d3"
android:textColor="#color/black"
android:layout_height="wrap_content"/>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
style="#style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_marginTop="20dp"
android:layout_height="wrap_content">
<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent" android:id="#+id/etLocation"
android:hint="Location" android:textColorHint="#d3d3d3"
android:layout_height="wrap_content"/>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
style="#style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_marginTop="20dp"
android:layout_height="wrap_content">
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/etDate"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Date"
android:textColorHint="#d3d3d3" />
</com.google.android.material.textfield.TextInputLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<androidx.appcompat.widget.AppCompatImageView
android:layout_margin="10dp"
android:id="#+id/imgView"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="250dp"/>
<TextView
android:id="#+id/tvAddImage"
android:gravity="center"
android:layout_margin="10dp"
android:textSize="25sp"
android:layout_weight="1"
android:layout_width="0dp"
android:text="ADD IMAGE"
android:layout_height="250dp"/>
</LinearLayout>
</ScrollView>
Here is what the layout is showing
enter image description here
The problem is you are hosting multiple child inside scrollview,
Scrollview can host only single child. Please check below code for reference
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".AddHappyPlace">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<com.google.android.material.appbar.MaterialToolbar
android:id="#+id/toolbarAdd"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="#color/newColorPrimaryDark"
android:theme="#style/CustomNoActionBarTheme"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<com.google.android.material.textfield.TextInputLayout
style="#style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp">
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/etTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Title"
android:textColorHint="#d3d3d3" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
style="#style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp">
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/etDetails"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Details"
android:textColor="#color/black"
android:textColorHint="#d3d3d3" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
style="#style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp">
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/etLocation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Location"
android:textColorHint="#d3d3d3" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
style="#style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp">
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/etDate"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Date"
android:textColorHint="#d3d3d3" />
</com.google.android.material.textfield.TextInputLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<androidx.appcompat.widget.AppCompatImageView
android:id="#+id/imgView"
android:layout_width="0dp"
android:layout_height="250dp"
android:layout_margin="10dp"
android:layout_weight="1" />
<TextView
android:id="#+id/tvAddImage"
android:layout_width="0dp"
android:layout_height="250dp"
android:layout_margin="10dp"
android:layout_weight="1"
android:gravity="center"
android:text="ADD IMAGE"
android:textSize="25sp" />
</LinearLayout>
</LinearLayout>
</ScrollView>

scrollview not applying for the buttons in android

Hi in the below xml layout I am designed a form with scollview .When I am scrolling buttons are not visibling .
I want to display buttons also when I am scrooling a form.Scrollview not applying for the complete form as well as buttons save and cancel.but save and cancel buttons are not displaying.
can any one help me where i did mistake
xml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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/back_blue">
<ScrollView
android:id="#+id/below"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#+id/header">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="fill_horizontal"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:orientation="vertical">
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp">
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/account_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="#string/account_name"
android:inputType="textEmailAddress"
android:textColorHint="#0072BA"
android:textSize="15sp"
app:hintTextAppearance="#style/TextAppearence.App.TextInputLayout" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp">
<fr.ganfra.materialspinner.MaterialSpinner
android:id="#+id/ownership_type"
android_id="#+id/ownership_type"
android_layout_height="wrap_content"
android_layout_width="match_parent"
app_ms_arrowColor="#0000FF"
app_ms_arrowSize="16dp"
app_ms_floatingLabelColor="#00FF00"
app_ms_floatingLabelText="floating label"
app_ms_hint="hint"
app_ms_hintColor="#00FF00"
app_ms_multiline="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:ms_arrowColor="#color/black"
app:ms_hintColor="#color/black" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp">
<fr.ganfra.materialspinner.MaterialSpinner
android:id="#+id/facility_type"
android_id="#+id/facility_type"
android_layout_height="wrap_content"
android_layout_width="match_parent"
app_ms_arrowColor="#0000FF"
app_ms_arrowSize="16dp"
app_ms_hint="hint"
app_ms_hintColor="#00FF00"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:ms_arrowColor="#color/black"
app:ms_hintColor="#color/black" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
app:passwordToggleTint="#color/colorAccent">
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="#string/email"
android:inputType="number" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp">
<fr.ganfra.materialspinner.MaterialSpinner
android:id="#+id/account_manger"
android_id="#+id/account_manger"
android_layout_height="wrap_content"
android_layout_width="match_parent"
app_ms_arrowColor="#0000FF"
app_ms_arrowSize="16dp"
app_ms_hint="hint"
app_ms_hintColor="#00FF00"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:ms_arrowColor="#color/black"
app:ms_hintColor="#color/black" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
app:passwordToggleTint="#color/colorAccent">
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/editMobilephone"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="#string/custom_mobile"
android:inputType="number" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
app:passwordToggleEnabled="true"
app:passwordToggleTint="#color/colorAccent">
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/bill_add"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="#string/bill_address"
android:inputType="text"
android:lines="5"
android:maxLines="5" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
app:passwordToggleEnabled="true"
app:passwordToggleTint="#color/colorAccent">
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/bill_city"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="#string/bill_city"
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:layout_margin="10dp"
app:passwordToggleEnabled="true"
app:passwordToggleTint="#color/colorAccent">
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/bill_dist"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="#string/bill_district"
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:layout_margin="10dp">
<fr.ganfra.materialspinner.MaterialSpinner
android:id="#+id/state"
android_id="#+id/state"
android_layout_height="wrap_content"
android_layout_width="match_parent"
app_ms_arrowColor="#0000FF"
app_ms_arrowSize="16dp"
app_ms_floatingLabelColor="#00FF00"
app_ms_floatingLabelText="floating label"
app_ms_hint="hint"
app_ms_hintColor="#00FF00"
app_ms_multiline="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:ms_arrowColor="#color/black"
app:ms_hintColor="#color/black" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
app:passwordToggleEnabled="true"
app:passwordToggleTint="#color/colorAccent">
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/bill_country"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="#string/bill_country"
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:layout_margin="10dp"
android:layout_marginTop="8dp"
app:passwordToggleEnabled="true"
app:passwordToggleTint="#color/colorAccent">
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/bill_pin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="#string/bill_pin"
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:layout_margin="10dp"
android:layout_marginTop="8dp"
app:passwordToggleEnabled="true"
app:passwordToggleTint="#color/colorAccent">
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/website"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="#string/bill_pin"
android:inputType="text" />
</com.google.android.material.textfield.TextInputLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/btnLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="#color/colorPrimary"
android:orientation="horizontal"
android:weightSum="2">
<androidx.appcompat.widget.AppCompatButton
android:id="#+id/save"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:background="#color/colorPrimary"
android:gravity="center"
android:text="#string/save"
android:textColor="#android:color/white"
android:textSize="16sp" />
<View
android:layout_width="1dp"
android:layout_height="fill_parent"
android:background="#color/White" />
<androidx.appcompat.widget.AppCompatButton
android:id="#+id/cancel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:layout_gravity="center"
android:layout_weight="1"
android:background="#color/colorPrimary"
android:gravity="center"
android:text="#string/cancel"
android:textColor="#android:color/white"
android:textSize="16sp" />
</LinearLayout>
</LinearLayout>
</ScrollView>
</RelativeLayout>
Try like this
<RelativeLayout>
<ScrollView>
<LinearLayout>
.......
</LinearLayout>
</ScrollView>
</RelativeLayout>
You need to create the button outside the ScrollView.
Try this,
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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/back_blue">
<ScrollView
android:id="#+id/below"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="#+id/btnLayout"
android:layout_below="#+id/header">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="fill_horizontal"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:orientation="vertical">
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp">
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/account_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="#string/account_name"
android:inputType="textEmailAddress"
android:textColorHint="#0072BA"
android:textSize="15sp"
app:hintTextAppearance="#style/TextAppearence.App.TextInputLayout" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp">
<fr.ganfra.materialspinner.MaterialSpinner
android:id="#+id/ownership_type"
android_id="#+id/ownership_type"
android_layout_height="wrap_content"
android_layout_width="match_parent"
app_ms_arrowColor="#0000FF"
app_ms_arrowSize="16dp"
app_ms_floatingLabelColor="#00FF00"
app_ms_floatingLabelText="floating label"
app_ms_hint="hint"
app_ms_hintColor="#00FF00"
app_ms_multiline="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:ms_arrowColor="#color/black"
app:ms_hintColor="#color/black" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp">
<fr.ganfra.materialspinner.MaterialSpinner
android:id="#+id/facility_type"
android_id="#+id/facility_type"
android_layout_height="wrap_content"
android_layout_width="match_parent"
app_ms_arrowColor="#0000FF"
app_ms_arrowSize="16dp"
app_ms_hint="hint"
app_ms_hintColor="#00FF00"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:ms_arrowColor="#color/black"
app:ms_hintColor="#color/black" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
app:passwordToggleTint="#color/colorAccent">
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="#string/email"
android:inputType="number" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp">
<fr.ganfra.materialspinner.MaterialSpinner
android:id="#+id/account_manger"
android_id="#+id/account_manger"
android_layout_height="wrap_content"
android_layout_width="match_parent"
app_ms_arrowColor="#0000FF"
app_ms_arrowSize="16dp"
app_ms_hint="hint"
app_ms_hintColor="#00FF00"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:ms_arrowColor="#color/black"
app:ms_hintColor="#color/black" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
app:passwordToggleTint="#color/colorAccent">
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/editMobilephone"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="#string/custom_mobile"
android:inputType="number" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
app:passwordToggleEnabled="true"
app:passwordToggleTint="#color/colorAccent">
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/bill_add"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="#string/bill_address"
android:inputType="text"
android:lines="5"
android:maxLines="5" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
app:passwordToggleEnabled="true"
app:passwordToggleTint="#color/colorAccent">
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/bill_city"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="#string/bill_city"
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:layout_margin="10dp"
app:passwordToggleEnabled="true"
app:passwordToggleTint="#color/colorAccent">
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/bill_dist"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="#string/bill_district"
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:layout_margin="10dp">
<fr.ganfra.materialspinner.MaterialSpinner
android:id="#+id/state"
android_id="#+id/state"
android_layout_height="wrap_content"
android_layout_width="match_parent"
app_ms_arrowColor="#0000FF"
app_ms_arrowSize="16dp"
app_ms_floatingLabelColor="#00FF00"
app_ms_floatingLabelText="floating label"
app_ms_hint="hint"
app_ms_hintColor="#00FF00"
app_ms_multiline="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:ms_arrowColor="#color/black"
app:ms_hintColor="#color/black" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
app:passwordToggleEnabled="true"
app:passwordToggleTint="#color/colorAccent">
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/bill_country"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="#string/bill_country"
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:layout_margin="10dp"
android:layout_marginTop="8dp"
app:passwordToggleEnabled="true"
app:passwordToggleTint="#color/colorAccent">
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/bill_pin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="#string/bill_pin"
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:layout_margin="10dp"
android:layout_marginTop="8dp"
app:passwordToggleEnabled="true"
app:passwordToggleTint="#color/colorAccent">
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/website"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="#string/bill_pin"
android:inputType="text" />
</com.google.android.material.textfield.TextInputLayout>
</LinearLayout>
</LinearLayout>
</ScrollView>
<LinearLayout
android:id="#+id/btnLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="#color/colorPrimary"
android:orientation="horizontal"
android:weightSum="2">
<androidx.appcompat.widget.AppCompatButton
android:id="#+id/save"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:background="#color/colorPrimary"
android:gravity="center"
android:text="#string/save"
android:textColor="#android:color/white"
android:textSize="16sp" />
<View
android:layout_width="1dp"
android:layout_height="fill_parent"
android:background="#color/White" />
<androidx.appcompat.widget.AppCompatButton
android:id="#+id/cancel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:layout_gravity="center"
android:layout_weight="1"
android:background="#color/colorPrimary"
android:gravity="center"
android:text="#string/cancel"
android:textColor="#android:color/white"
android:textSize="16sp" />
</LinearLayout>
</RelativeLayout>
Expected behavior for this answer
If you draw the layout form you want in question, it will be easier to understand.

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

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>

Categories

Resources