Scroll view making the reason to crash - android

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>

Related

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>

Getting setError view position at different position

I am new to Android. I use setError for edittext but it appears on other position then its actual position. I am having it at position shown in this image:
However, I need it to be on editText:
I don't want to use textInputLayout also.
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:gradient="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/main_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/colorPrimaryDark"
android:fitsSystemWindows="true"
android:orientation="vertical"
android:weightSum="2">
<com.dynamitechetan.flowinggradient.FlowingGradient
android:layout_width="match_parent"
android:layout_height="match_parent"
gradient:alpha="4"
gradient:transition_drawable="#drawable/login_bg_translate_anim"
gradient:transition_duration="1000" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="2">
<LinearLayout
android:id="#+id/sign_in_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:gravity="center"
android:orientation="vertical"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingTop="90dp"
android:visibility="visible"
android:weightSum="2"
tools:visibility="visible">
<Button
android:id="#+id/sign_in_button"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="#drawable/round_btn_shape"
android:foreground="?attr/selectableItemBackground"
android:text="Sign in With Google"
android:textAppearance="?android:attr/textAppearanceMedium"
android:theme="#style/ThemeOverlay.MyDarkButton" />
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:layout_marginTop="16dp"
android:gravity="center_horizontal"
android:text="OR"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#fff"
android:textSize="20dp" />
<Button
android:id="#+id/phone_login_slct_btn"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="#drawable/round_btn_shape"
android:foreground="?attr/selectableItemBackground"
android:gravity="center"
android:onClick="onClickPhone"
android:text="Sign in With Phone"
android:textAppearance="?android:attr/textAppearanceMedium"
android:theme="#style/ThemeOverlay.MyDarkButton" />
</LinearLayout>
<android.support.v7.widget.CardView
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_above="#+id/sign_in_layout"
android:layout_centerHorizontal="true"
android:layout_gravity="center"
android:background="?attr/selectableItemBackground"
app:cardBackgroundColor="#fff"
app:cardCornerRadius="25dp">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:foreground="?attr/selectableItemBackground"
android:src="#drawable/ic_explicit_black_24dp" />
</android.support.v7.widget.CardView>
</RelativeLayout>
<android.support.v4.widget.NestedScrollView
android:id="#+id/bottom_sheet"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipToPadding="true"
app:layout_behavior="android.support.design.widget.BottomSheetBehavior">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:weightSum="1">
<ProgressBar
android:id="#+id/progressBar_phone"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight=".1"
android:indeterminate="true"
android:visibility="invisible" />
<RelativeLayout
android:id="#+id/relative_layout_all_element_phone_auth"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="0.9"
android:background="#4D0178B8"
android:gravity="center_vertical">
<LinearLayout
android:id="#+id/phone_auth_fields"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingLeft="16dp"
android:paddingRight="16dp">
<LinearLayout
android:id="#+id/register_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:animateLayoutChanges="true"
android:orientation="horizontal"
android:visibility="visible"
android:weightSum="1.0">
<android.support.v7.widget.AppCompatEditText
android:id="#+id/field_phone_number"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.7"
android:hint="Phone Number"
android:inputType="phone"
android:textColor="#color/white"
android:textColorHint="#CECECE"
android:textCursorDrawable="#drawable/custom_cursor"
android:textStyle="bold"
app:backgroundTint="#color/white" />
<Button
android:id="#+id/button_start_verification"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.3"
android:foreground="?attr/selectableItemBackground"
android:text="Start"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textStyle="bold"
android:theme="#style/ThemeOverlay.MyDarkButton" />
</LinearLayout>
<LinearLayout
android:id="#+id/otpcheck_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:animateLayoutChanges="true"
android:orientation="vertical"
android:visibility="gone"
android:weightSum="2.0">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="horizontal"
android:weightSum="2">
<android.support.v7.widget.AppCompatEditText
android:id="#+id/show_phone_number"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1.0"
android:focusable="false"
android:focusableInTouchMode="false"
android:hint="Phone Number"
android:inputType="phone"
android:textColor="#color/white"
android:textColorHint="#CECECE"
android:textCursorDrawable="#drawable/custom_cursor"
app:backgroundTint="#color/white" />
<android.support.v7.widget.AppCompatEditText
android:id="#+id/field_verification_code"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1.0"
android:hint="Verification Code"
android:inputType="phone"
android:textColor="#color/white"
android:textColorHint="#CECECE"
android:textCursorDrawable="#drawable/custom_cursor"
app:backgroundTint="#color/white" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="horizontal"
android:weightSum="2">
<Button
android:id="#+id/button_verify_phone"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1.0"
android:foreground="?attr/selectableItemBackground"
android:text="Verify"
android:theme="#style/ThemeOverlay.MyDarkButton" />
<Button
android:id="#+id/button_resend"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1.0"
android:foreground="?attr/selectableItemBackground"
android:text="Resend"
android:theme="#style/ThemeOverlay.MyDarkButton" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</RelativeLayout>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>

How to set toolbar to fit to activity In android

I am trying to add toolbar to activity but it scrolls if i am scrolling
following is the code i have tried
I need to no scroll to toolbar only contains i want to scroll. I want to design like this image how to design form like below image
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:card_view="http://schemas.android.com/tools"
android:id="#+id/CoordinatorLayout_login"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:fillViewport="true"
android:focusable="true"
android:focusableInTouchMode="true"
android:gravity="center"
android:orientation="vertical">
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_behavior="#string/appbar_scrolling_view_behavior">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v7.widget.Toolbar
android:id="#+id/toolbarforprofile"
android:layout_width="match_parent"
android:layout_height="45dp"
android:background="?attr/colorPrimary"
android:minHeight="?attr/actionBarSize"
android:titleTextColor="#ffffff" />
<LinearLayout
android:id="#+id/profile_details"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:orientation="vertical"
android:padding="16dp">
<TextView
android:id="#+id/txtservicedetails"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:text="#string/app_name"
android:textColor="#color/colorAccent"
android:textSize="20sp"
android:textStyle="bold" />
<android.support.design.widget.TextInputLayout
android:id="#+id/tl_requirement"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<AutoCompleteTextView
android:id="#+id/editTextrequirement"
android:layout_width="match_parent"
android:layout_height="100dp"
android:hint="Your requirement?"
android:inputType="textMultiLine|textCapSentences"
android:maxLines="4"
android:singleLine="true"
android:text="" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/tl_dateofvisit"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<AutoCompleteTextView
android:id="#+id/et_dateofvisit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusable="false"
android:hint="Date Of Visit"
android:inputType="date"
android:maxLines="1"
android:singleLine="true"
android:text="" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/tl_fortime"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<AutoCompleteTextView
android:id="#+id/et_time"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusable="false"
android:hint="Time Of Visit"
android:inputType="time"
android:maxLines="1"
android:singleLine="true"
android:text="" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/tl_noofperson"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<AutoCompleteTextView
android:id="#+id/et_noofperson"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Number Of Person You Need"
android:inputType="number"
android:maxLines="1"
android:singleLine="true"
android:text="" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/tl_serviceadd"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<AutoCompleteTextView
android:id="#+id/et_serviceadd"
android:layout_width="match_parent"
android:layout_height="100dp"
android:hint="Service Address"
android:inputType="textMultiLine|textCapSentences"
android:maxLength="2000"
android:maxLines="4"
android:singleLine="true"
android:text="" />
</android.support.design.widget.TextInputLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Button
android:id="#+id/btn_submit"
style="#style/Widget.AppCompat.Button.Colored"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Submit"
android:textSize="20dp"
android:textStyle="bold" />
<ProgressBar
android:id="#+id/btnsubmit"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_centerInParent="true"
android:layout_gravity="center"
android:visibility="gone" />
</RelativeLayout>
</LinearLayout>
<!--
<ImageView
android:layout_width="250dp"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_margin="4dp"
android:adjustViewBounds="true"
android:fitsSystemWindows="true"
android:scaleType="fitXY"
android:src="#drawable/logo" />
-->
<!-- <android.support.v7.widget.CardView
android:id="#+id/card_login"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="7dp"
android:layout_marginLeft="7dp"
android:layout_marginRight="7dp"
android:elevation="0dp"
app:cardBackgroundColor="#android:color/white"
app:cardElevation="4dp"
card_view:cardCornerRadius="2dp"
card_view:cardUseCompatPadding="true">-->
<!-- </android.support.v7.widget.CardView>-->
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</RelativeLayout>
</android.support.design.widget.CoordinatorLayout>
[1]: https://i.stack.imgur.com/8tlhv.png
try this it will help you.
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:card_view="http://schemas.android.com/tools"
android:id="#+id/CoordinatorLayout_login"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="#style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="#style/MyDarkToolbarStyle">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/colorPrimary"
android:gravity="end"
android:orientation="horizontal"
android:weightSum="8">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="8"
android:background="#color/colorPrimary"
android:gravity="center"
android:orientation="horizontal"
android:weightSum="8">
<TextView
android:id="#+id/txt_header"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:layout_weight="8"
android:gravity="left"
android:text="Project Edit"
android:textColor="#color/white"
android:textSize="18sp"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.Toolbar>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_behavior="#string/appbar_scrolling_view_behavior">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v7.widget.Toolbar
android:id="#+id/toolbarforprofile"
android:layout_width="match_parent"
android:layout_height="45dp"
android:background="?attr/colorPrimary"
android:minHeight="?attr/actionBarSize"
android:titleTextColor="#ffffff" />
<LinearLayout
android:id="#+id/profile_details"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:orientation="vertical"
android:padding="16dp">
<TextView
android:id="#+id/txtservicedetails"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:text="#string/app_name"
android:textColor="#color/colorAccent"
android:textSize="20sp"
android:textStyle="bold" />
<android.support.design.widget.TextInputLayout
android:id="#+id/tl_requirement"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<AutoCompleteTextView
android:id="#+id/editTextrequirement"
android:layout_width="match_parent"
android:layout_height="100dp"
android:hint="Your requirement?"
android:inputType="textMultiLine|textCapSentences"
android:maxLines="4"
android:singleLine="true"
android:text="" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/tl_dateofvisit"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<AutoCompleteTextView
android:id="#+id/et_dateofvisit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusable="false"
android:hint="Date Of Visit"
android:inputType="date"
android:maxLines="1"
android:singleLine="true"
android:text="" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/tl_fortime"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<AutoCompleteTextView
android:id="#+id/et_time"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusable="false"
android:hint="Time Of Visit"
android:inputType="time"
android:maxLines="1"
android:singleLine="true"
android:text="" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/tl_noofperson"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<AutoCompleteTextView
android:id="#+id/et_noofperson"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Number Of Person You Need"
android:inputType="number"
android:maxLines="1"
android:singleLine="true"
android:text="" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/tl_serviceadd"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<AutoCompleteTextView
android:id="#+id/et_serviceadd"
android:layout_width="match_parent"
android:layout_height="100dp"
android:hint="Service Address"
android:inputType="textMultiLine|textCapSentences"
android:maxLength="2000"
android:maxLines="4"
android:singleLine="true"
android:text="" />
</android.support.design.widget.TextInputLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Button
android:id="#+id/btn_submit"
style="#style/Widget.AppCompat.Button.Colored"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Submit"
android:textSize="20dp"
android:textStyle="bold" />
<ProgressBar
android:id="#+id/btnsubmit"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_centerInParent="true"
android:layout_gravity="center"
android:visibility="gone" />
</RelativeLayout>
</LinearLayout>
<!--
<ImageView
android:layout_width="250dp"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_margin="4dp"
android:adjustViewBounds="true"
android:fitsSystemWindows="true"
android:scaleType="fitXY"
android:src="#drawable/logo" />
-->
<!-- <android.support.v7.widget.CardView
android:id="#+id/card_login"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="7dp"
android:layout_marginLeft="7dp"
android:layout_marginRight="7dp"
android:elevation="0dp"
app:cardBackgroundColor="#android:color/white"
app:cardElevation="4dp"
card_view:cardCornerRadius="2dp"
card_view:cardUseCompatPadding="true">-->
<!-- </android.support.v7.widget.CardView>-->
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</RelativeLayout>
</android.support.design.widget.CoordinatorLayout>
layout design following this.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="#style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="#style/MyDarkToolbarStyle">
// Do ur custom app bar
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/colorPrimary"
android:gravity="end"
android:orientation="horizontal"
android:weightSum="8">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="8"
android:background="#color/colorPrimary"
android:gravity="center"
android:orientation="horizontal"
android:weightSum="8">
<TextView
android:id="#+id/txt_header"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:layout_weight="8"
android:gravity="left"
android:text="Project Edit"
android:textColor="#color/white"
android:textSize="18sp"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.Toolbar>
</android.support.design.widget.AppBarLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
// add ur design
</LinearLayout>
</ScrollView>
</LinearLayout>
</LinearLayout>
manifest file add this theme
android:theme="#style/AppTheme.NoActionBar"

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>

Tool bar is moving up on keyboard launch in EditText focus

Activity Toolbar is moving up when keyboard launches
is there any problem in my layout.
Tried solutions:
Android Toolbar moves up when keyboard appears
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout 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:fitsSystemWindows="true"
android:background="#E0E0E0"
tools:context="com.moozup.moozup_new.activity.EditMyProfileActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="#style/Theme.DesignDemo.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar_edit_id"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary">
<TextView
android:id="#+id/text_profile_reset_id"
style="?android:actionBarTabTextStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:layout_marginEnd="40dp"
android:drawableLeft="#android:drawable/ic_menu_rotate"
android:drawablePadding="8dp"
android:gravity="center_vertical"
android:paddingLeft="20dp"
android:text="Reset" />
</android.support.v7.widget.Toolbar>
</android.support.design.widget.AppBarLayout>
<include layout="#layout/edit_mtprofile_content" />
</LinearLayout>
<android.support.design.widget.FloatingActionButton
android:id="#+id/fab_save_id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackgroundBorderless"
android:layout_gravity="bottom|end"
android:layout_margin="#dimen/fab_margin"
app:srcCompat="#android:drawable/ic_menu_save" />
</android.support.design.widget.CoordinatorLayout>
And Main Content is Here:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:card_view="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:paddingLeft="10dp"
android:paddingRight="10dp"
android:isScrollContainer="false">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v4.widget.Space
android:layout_width="match_parent"
android:layout_height="50dp" />
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="20dp"
android:layout_gravity="center"
tools:context=".activity.EditProfileActivity">
<android.support.v7.widget.CardView
android:id="#+id/parent_cardView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="50dp"
app:cardBackgroundColor="#android:color/white"
app:cardCornerRadius="#dimen/cardview_default_radius"
app:cardElevation="4dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
android:layout_marginTop="80dp"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<android.support.design.widget.TextInputLayout
android:layout_width="160dp"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp"
android:gravity="center">
<EditText
android:id="#+id/edit_first_name_id"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="First Name"
android:inputType="textPersonName"
android:textAppearance="#style/Base.TextAppearance.AppCompat.Body2" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="160dp"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp"
android:gravity="center">
<EditText
android:id="#+id/edit_last_name_id"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Last Name"
android:inputType="textPersonName"
android:textAppearance="#style/Base.TextAppearance.AppCompat.Body2" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp"
android:gravity="center">
<EditText
android:id="#+id/edit_email_id"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="email"
android:inputType="textPersonName"
android:textAppearance="#style/Base.TextAppearance.AppCompat.Body2" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<android.support.design.widget.TextInputLayout
android:layout_width="160dp"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp"
android:gravity="center">
<EditText
android:id="#+id/edit_designation_id"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Designation"
android:inputType="textPersonName"
android:textAppearance="#style/Base.TextAppearance.AppCompat.Body2" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="160dp"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp"
android:gravity="center">
<EditText
android:id="#+id/edit_company_id"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Company"
android:inputType="textPersonName"
android:textAppearance="#style/Base.TextAppearance.AppCompat.Body2" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<android.support.design.widget.TextInputLayout
android:layout_width="160dp"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp"
android:gravity="center">
<EditText
android:id="#+id/edit_contact_id"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Contact"
android:inputType="textPersonName"
android:textAppearance="#style/Base.TextAppearance.AppCompat.Body2" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="160dp"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp"
android:gravity="center">
<EditText
android:id="#+id/edit_address_id"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Address"
android:inputType="textPersonName"
android:textAppearance="#style/Base.TextAppearance.AppCompat.Body2" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp"
android:gravity="center">
<EditText
android:id="#+id/edit_description_id"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="About"
android:inputType="textPersonName"
android:textAppearance="#style/Base.TextAppearance.AppCompat.Body2" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp"
android:gravity="center">
<EditText
android:id="#+id/edit_talk_id"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Talk to me"
android:inputType="textPersonName"
android:textAppearance="#style/Base.TextAppearance.AppCompat.Body2" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp"
android:gravity="center">
<EditText
android:id="#+id/edit_linked_in_id"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Linked Url"
android:inputType="textPersonName"
android:textAppearance="#style/Base.TextAppearance.AppCompat.Body2" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp"
android:gravity="center">
<EditText
android:id="#+id/edit_facebook_id"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Twitter Url"
android:inputType="textPersonName"
android:textAppearance="#style/Base.TextAppearance.AppCompat.Body2" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp"
android:gravity="center">
<EditText
android:id="#+id/edit_twitter_id"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Twitter Url"
android:inputType="textPersonName"
android:textAppearance="#style/Base.TextAppearance.AppCompat.Body2" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
<RelativeLayout
android:id="#+id/prof"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:elevation="10dp">
<de.hdodenhof.circleimageview.CircleImageView
android:id="#+id/circular_edit_image_id"
android:layout_width="130dp"
android:layout_height="130dp"
android:layout_gravity="center_horizontal"
android:src="#drawable/user_image"
app:finalHeight="#dimen/image_final_width"
app:finalYPosition="2dp"
app:startHeight="2dp"
app:startToolbarPosition="2dp"
app:startXPosition="2dp" />
<android.support.design.widget.FloatingActionButton
android:id="#+id/fab_edit_camera_id"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_alignBottom="#id/circular_edit_image_id"
android:layout_alignEnd="#id/circular_edit_image_id"
android:scaleType="fitXY"
app:fabSize="normal"
app:layout_anchorGravity="bottom"
app:srcCompat="#drawable/ic_menu_camera" />
</RelativeLayout>
</FrameLayout>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
Is there any problem with layout design.
Any suggestions?Thanks in advance.
Sample ScreenShot:
enter image description here
Set isScrollContainer to true
android:isScrollContainer="true"
Hope this helps :)

Categories

Resources