I know this is common to ask but I'm confused. I have a RelativeLayout
forms with editText
and spinner
, now I want to apply the ScrollView
to scroll the data from above to bottom since I have a lot of data to be inputted. I tried putting Scrollview
after the first layout but it doesn't work. Need help
Activitymain.xml
<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:orientation="vertical"
android:background="@color/background"
tools:context=".SignUp">
<RelativeLayout
android:id="@ id/linear2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@ id/confirmRequestBtn"
android:layout_marginLeft="10dp"
android:layout_marginTop="4dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="5dp"
android:orientation="vertical"
android:background="@drawable/selector_fieldset_background">
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@ id/til_Idno"
app:counterEnabled="true"
app:counterMaxLength="23"
app:endIconMode="clear_text"
app:helperText="Good valid!"
android:layout_marginTop="30dp"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
app:helperTextTextColor="@color/validation"
app:startIconDrawable="@drawable/ic_creditcard"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxLength="23"
android:hint="ID No."
android:id="@ id/edtIdno"
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:id="@ id/til_patientType"
app:helperText="Mandatory"
android:layout_marginTop="5dp"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
app:helperTextTextColor="@color/validation"
android:layout_below="@ id/til_Idno"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense">
<Spinner
android:id="@ id/spinnerAppointmentCat"
android:layout_width= "match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/edtIdno"/>
</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_complaints"
app:helperText="Mandatory"
android:layout_marginTop="5dp"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
app:helperTextTextColor="@color/validation"
android:layout_below="@ id/til_patientType"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense">
<Spinner
android:id="@ id/spinnerComplaints"
android:layout_width= "match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/spinnerAppointmentCat"/>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@ id/til_firstname"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:endIconMode="clear_text"
app:helperText="Mandatory"
android:layout_marginTop="25dp"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
app:helperTextTextColor="@color/validation"
app:startIconDrawable="@drawable/ic_series"
android:layout_below="@ id/til_complaints"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="First name"
android:id="@ id/edtFirstname"
android:inputType="number"
android:layout_below="@id/spinnerComplaints"/>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@ id/til_middlename"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:endIconMode="clear_text"
app:helperText="Mandatory"
android:layout_marginTop="25dp"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
app:helperTextTextColor="@color/validation"
app:startIconDrawable="@drawable/ic_series"
android:layout_below="@ id/til_firstname"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Middle name/initial"
android:id="@ id/edtMiddleName"
android:inputType="number"
android:layout_below="@id/edtFirstname"/>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@ id/til_lastname"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:endIconMode="clear_text"
app:helperText="Mandatory"
android:layout_marginTop="25dp"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
app:helperTextTextColor="@color/validation"
app:startIconDrawable="@drawable/ic_series"
android:layout_below="@ id/til_middlename"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Middle name/initial"
android:id="@ id/edtLastname"
android:inputType="number"
android:layout_below="@id/edtMiddleName"/>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@ id/til_sex"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:endIconMode="clear_text"
app:helperText="Mandatory"
android:layout_marginTop="25dp"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
app:helperTextTextColor="@color/validation"
app:startIconDrawable="@drawable/ic_series"
android:layout_below="@ id/til_lastname"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Sex"
android:id="@ id/edtSex"
android:inputType="number"
android:layout_below="@id/edtLastname"/>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@ id/til_birthdate"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:endIconMode="clear_text"
app:helperText="Mandatory"
android:layout_marginTop="25dp"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
app:helperTextTextColor="@color/validation"
app:startIconDrawable="@drawable/ic_series"
android:layout_below="@ id/til_sex"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Sex"
android:id="@ id/edtBirthdate"
android:inputType="number"
android:layout_below="@id/edtSex"/>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@ id/til_cpno"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:endIconMode="clear_text"
app:helperText="Mandatory"
android:layout_marginTop="25dp"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
app:helperTextTextColor="@color/validation"
app:startIconDrawable="@drawable/ic_series"
android:layout_below="@ id/til_birthdate"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Contact"
android:id="@ id/edtContact"
android:inputType="number"
android:layout_below="@id/edtBirthdate"/>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@ id/til_email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:endIconMode="clear_text"
app:helperText="Mandatory"
android:layout_marginTop="25dp"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
app:helperTextTextColor="@color/validation"
app:startIconDrawable="@drawable/ic_series"
android:layout_below="@ id/til_birthdate"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Email"
android:id="@ id/edtEmail"
android:inputType="number"
android:layout_below="@id/edtContact"/>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@ id/til_address"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:endIconMode="clear_text"
app:helperText="Mandatory"
android:layout_marginTop="25dp"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
app:helperTextTextColor="@color/validation"
app:startIconDrawable="@drawable/ic_series"
android:layout_below="@ id/til_email"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Address"
android:id="@ id/edtAddress"
android:inputType="number"
android:layout_below="@id/edtEmail"/>
</com.google.android.material.textfield.TextInputLayout>
</RelativeLayout>
<TextView
android:id="@ id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@color/background"
android:layout_marginLeft="20dp"
android:text="Appointment"
android:fontFamily="sans-serif-condensed"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="15dp" />
<Button
android:id="@ id/confirmRequestBtn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="@drawable/mybutton"
android:textSize="20dp"
android:text="Confirm Request"
android:textColor="@color/white"
android:layout_marginBottom="5dp"/>
UPDATED : This is what I've tried I put ScrollView
after the second RelativeLayout
but where should I put the close tag of ScrollView
and LinearLayout
it brokes the design If I put it before RelativeLayout
<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:orientation="vertical"
android:background="@color/background"
tools:context=".SignUp">
<RelativeLayout
android:id="@ id/linear2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@ id/confirmRequestBtn"
android:layout_marginLeft="10dp"
android:layout_marginTop="4dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="5dp"
android:orientation="vertical"
android:background="@drawable/selector_fieldset_background">
<ScrollView
android:layout_width="wrap_content"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@ id/til_Idno"
app:counterEnabled="true"
app:counterMaxLength="23"
app:endIconMode="clear_text"
app:helperText="Good valid!"
android:layout_marginTop="30dp"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
app:helperTextTextColor="@color/validation"
app:startIconDrawable="@drawable/ic_creditcard"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxLength="23"
android:hint="ID No."
android:id="@ id/edtIdno"
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:id="@ id/til_patientType"
app:helperText="Mandatory"
android:layout_marginTop="5dp"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
app:helperTextTextColor="@color/validation"
android:layout_below="@ id/til_Idno"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense">
<Spinner
android:id="@ id/spinnerAppointmentCat"
android:layout_width= "match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/edtIdno"/>
</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_complaints"
app:helperText="Mandatory"
android:layout_marginTop="5dp"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
app:helperTextTextColor="@color/validation"
android:layout_below="@ id/til_patientType"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense">
<Spinner
android:id="@ id/spinnerComplaints"
android:layout_width= "match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/spinnerAppointmentCat"/>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@ id/til_firstname"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:endIconMode="clear_text"
app:helperText="Mandatory"
android:layout_marginTop="25dp"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
app:helperTextTextColor="@color/validation"
app:startIconDrawable="@drawable/ic_series"
android:layout_below="@ id/til_complaints"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="First name"
android:id="@ id/edtFirstname"
android:inputType="number"
android:layout_below="@id/spinnerComplaints"/>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@ id/til_middlename"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:endIconMode="clear_text"
app:helperText="Mandatory"
android:layout_marginTop="25dp"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
app:helperTextTextColor="@color/validation"
app:startIconDrawable="@drawable/ic_series"
android:layout_below="@ id/til_firstname"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Middle name/initial"
android:id="@ id/edtMiddleName"
android:inputType="number"
android:layout_below="@id/edtFirstname"/>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@ id/til_lastname"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:endIconMode="clear_text"
app:helperText="Mandatory"
android:layout_marginTop="25dp"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
app:helperTextTextColor="@color/validation"
app:startIconDrawable="@drawable/ic_series"
android:layout_below="@ id/til_middlename"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Middle name/initial"
android:id="@ id/edtLastname"
android:inputType="number"
android:layout_below="@id/edtMiddleName"/>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@ id/til_sex"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:endIconMode="clear_text"
app:helperText="Mandatory"
android:layout_marginTop="25dp"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
app:helperTextTextColor="@color/validation"
app:startIconDrawable="@drawable/ic_series"
android:layout_below="@ id/til_lastname"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Sex"
android:id="@ id/edtSex"
android:inputType="number"
android:layout_below="@id/edtLastname"/>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@ id/til_birthdate"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:endIconMode="clear_text"
app:helperText="Mandatory"
android:layout_marginTop="25dp"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
app:helperTextTextColor="@color/validation"
app:startIconDrawable="@drawable/ic_series"
android:layout_below="@ id/til_sex"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Sex"
android:id="@ id/edtBirthdate"
android:inputType="number"
android:layout_below="@id/edtSex"/>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@ id/til_cpno"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:endIconMode="clear_text"
app:helperText="Mandatory"
android:layout_marginTop="25dp"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
app:helperTextTextColor="@color/validation"
app:startIconDrawable="@drawable/ic_series"
android:layout_below="@ id/til_birthdate"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Contact"
android:id="@ id/edtContact"
android:inputType="number"
android:layout_below="@id/edtBirthdate"/>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@ id/til_email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:endIconMode="clear_text"
app:helperText="Mandatory"
android:layout_marginTop="25dp"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
app:helperTextTextColor="@color/validation"
app:startIconDrawable="@drawable/ic_series"
android:layout_below="@ id/til_birthdate"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Email"
android:id="@ id/edtEmail"
android:inputType="number"
android:layout_below="@id/edtContact"/>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@ id/til_address"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:endIconMode="clear_text"
app:helperText="Mandatory"
android:layout_marginTop="25dp"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
app:helperTextTextColor="@color/validation"
app:startIconDrawable="@drawable/ic_series"
android:layout_below="@ id/til_email"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Address"
android:id="@ id/edtAddress"
android:inputType="number"
android:layout_below="@id/edtEmail"/>
</com.google.android.material.textfield.TextInputLayout>
</RelativeLayout>
<TextView
android:id="@ id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@color/background"
android:layout_marginLeft="20dp"
android:text="Appointment"
android:fontFamily="sans-serif-condensed"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="15dp" />
<Button
android:id="@ id/confirmRequestBtn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="@drawable/mybutton"
android:textSize="20dp"
android:text="Confirm Request"
android:textColor="@color/white"
android:layout_marginBottom="5dp"/>
</RelativeLayout>
CodePudding user response:
your ScrollView should contain a layout inside it :
EDIT
the attribut android:orientation
in your LinearLayout
should be vertical
instead of horizontal
<ScrollView
android:layout_width="wrap_content"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="Vertical">
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@ id/til_Idno"
app:counterEnabled="true"
app:counterMaxLength="23"
app:endIconMode="clear_text"
app:helperText="Good valid!"
android:layout_marginTop="30dp"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
app:helperTextTextColor="@color/validation"
app:startIconDrawable="@drawable/ic_creditcard"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxLength="23"
android:hint="ID No."
android:id="@ id/edtIdno"
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:id="@ id/til_patientType"
app:helperText="Mandatory"
android:layout_marginTop="5dp"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
app:helperTextTextColor="@color/validation"
android:layout_below="@ id/til_Idno"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense">
<Spinner
android:id="@ id/spinnerAppointmentCat"
android:layout_width= "match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/edtIdno"/>
</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_complaints"
app:helperText="Mandatory"
android:layout_marginTop="5dp"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
app:helperTextTextColor="@color/validation"
android:layout_below="@ id/til_patientType"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense">
<Spinner
android:id="@ id/spinnerComplaints"
android:layout_width= "match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/spinnerAppointmentCat"/>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@ id/til_firstname"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:endIconMode="clear_text"
app:helperText="Mandatory"
android:layout_marginTop="25dp"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
app:helperTextTextColor="@color/validation"
app:startIconDrawable="@drawable/ic_series"
android:layout_below="@ id/til_complaints"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="First name"
android:id="@ id/edtFirstname"
android:inputType="number"
android:layout_below="@id/spinnerComplaints"/>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@ id/til_middlename"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:endIconMode="clear_text"
app:helperText="Mandatory"
android:layout_marginTop="25dp"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
app:helperTextTextColor="@color/validation"
app:startIconDrawable="@drawable/ic_series"
android:layout_below="@ id/til_firstname"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Middle name/initial"
android:id="@ id/edtMiddleName"
android:inputType="number"
android:layout_below="@id/edtFirstname"/>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@ id/til_lastname"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:endIconMode="clear_text"
app:helperText="Mandatory"
android:layout_marginTop="25dp"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
app:helperTextTextColor="@color/validation"
app:startIconDrawable="@drawable/ic_series"
android:layout_below="@ id/til_middlename"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Middle name/initial"
android:id="@ id/edtLastname"
android:inputType="number"
android:layout_below="@id/edtMiddleName"/>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@ id/til_sex"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:endIconMode="clear_text"
app:helperText="Mandatory"
android:layout_marginTop="25dp"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
app:helperTextTextColor="@color/validation"
app:startIconDrawable="@drawable/ic_series"
android:layout_below="@ id/til_lastname"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Sex"
android:id="@ id/edtSex"
android:inputType="number"
android:layout_below="@id/edtLastname"/>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@ id/til_birthdate"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:endIconMode="clear_text"
app:helperText="Mandatory"
android:layout_marginTop="25dp"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
app:helperTextTextColor="@color/validation"
app:startIconDrawable="@drawable/ic_series"
android:layout_below="@ id/til_sex"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Sex"
android:id="@ id/edtBirthdate"
android:inputType="number"
android:layout_below="@id/edtSex"/>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@ id/til_cpno"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:endIconMode="clear_text"
app:helperText="Mandatory"
android:layout_marginTop="25dp"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
app:helperTextTextColor="@color/validation"
app:startIconDrawable="@drawable/ic_series"
android:layout_below="@ id/til_birthdate"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Contact"
android:id="@ id/edtContact"
android:inputType="number"
android:layout_below="@id/edtBirthdate"/>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@ id/til_email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:endIconMode="clear_text"
app:helperText="Mandatory"
android:layout_marginTop="25dp"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
app:helperTextTextColor="@color/validation"
app:startIconDrawable="@drawable/ic_series"
android:layout_below="@ id/til_birthdate"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Email"
android:id="@ id/edtEmail"
android:inputType="number"
android:layout_below="@id/edtContact"/>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@ id/til_address"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:endIconMode="clear_text"
app:helperText="Mandatory"
android:layout_marginTop="25dp"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
app:helperTextTextColor="@color/validation"
app:startIconDrawable="@drawable/ic_series"
android:layout_below="@ id/til_email"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Address"
android:id="@ id/edtAddress"
android:inputType="number"
android:layout_below="@id/edtEmail"/>
</com.google.android.material.textfield.TextInputLayout>
CodePudding user response:
As I understood by your question My solution is like....you must check whether its like that or not...have look into it.
<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:orientation="vertical"
android:background="@color/background"
tools:context=".SignUp">
<RelativeLayout
android:id="@ id/linear2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@ id/confirmRequestBtn"
android:layout_marginLeft="10dp"
android:layout_marginTop="4dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="5dp"
android:orientation="vertical"
android:background="@drawable/selector_fieldset_background">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@ id/til_Idno"
app:counterEnabled="true"
app:counterMaxLength="23"
app:endIconMode="clear_text"
app:helperText="Good valid!"
android:layout_marginTop="30dp"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
app:helperTextTextColor="@color/validation"
app:startIconDrawable="@drawable/ic_creditcard"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxLength="23"
android:hint="ID No."
android:id="@ id/edtIdno"
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:id="@ id/til_patientType"
app:helperText="Mandatory"
android:layout_marginTop="5dp"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
app:helperTextTextColor="@color/validation"
android:layout_below="@ id/til_Idno"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense">
<Spinner
android:id="@ id/spinnerAppointmentCat"
android:layout_width= "match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/edtIdno"/>
</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_complaints"
app:helperText="Mandatory"
android:layout_marginTop="5dp"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
app:helperTextTextColor="@color/validation"
android:layout_below="@ id/til_patientType"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense">
<Spinner
android:id="@ id/spinnerComplaints"
android:layout_width= "match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/spinnerAppointmentCat"/>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@ id/til_firstname"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:endIconMode="clear_text"
app:helperText="Mandatory"
android:layout_marginTop="25dp"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
app:helperTextTextColor="@color/validation"
app:startIconDrawable="@drawable/ic_series"
android:layout_below="@ id/til_complaints"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="First name"
android:id="@ id/edtFirstname"
android:inputType="number"
android:layout_below="@id/spinnerComplaints"/>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@ id/til_middlename"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:endIconMode="clear_text"
app:helperText="Mandatory"
android:layout_marginTop="25dp"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
app:helperTextTextColor="@color/validation"
app:startIconDrawable="@drawable/ic_series"
android:layout_below="@ id/til_firstname"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Middle name/initial"
android:id="@ id/edtMiddleName"
android:inputType="number"
android:layout_below="@id/edtFirstname"/>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@ id/til_lastname"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:endIconMode="clear_text"
app:helperText="Mandatory"
android:layout_marginTop="25dp"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
app:helperTextTextColor="@color/validation"
app:startIconDrawable="@drawable/ic_series"
android:layout_below="@ id/til_middlename"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Middle name/initial"
android:id="@ id/edtLastname"
android:inputType="number"
android:layout_below="@id/edtMiddleName"/>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@ id/til_sex"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:endIconMode="clear_text"
app:helperText="Mandatory"
android:layout_marginTop="25dp"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
app:helperTextTextColor="@color/validation"
app:startIconDrawable="@drawable/ic_series"
android:layout_below="@ id/til_lastname"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Sex"
android:id="@ id/edtSex"
android:inputType="number"
android:layout_below="@id/edtLastname"/>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@ id/til_birthdate"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:endIconMode="clear_text"
app:helperText="Mandatory"
android:layout_marginTop="25dp"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
app:helperTextTextColor="@color/validation"
app:startIconDrawable="@drawable/ic_series"
android:layout_below="@ id/til_sex"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Sex"
android:id="@ id/edtBirthdate"
android:inputType="number"
android:layout_below="@id/edtSex"/>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@ id/til_cpno"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:endIconMode="clear_text"
app:helperText="Mandatory"
android:layout_marginTop="25dp"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
app:helperTextTextColor="@color/validation"
app:startIconDrawable="@drawable/ic_series"
android:layout_below="@ id/til_birthdate"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Contact"
android:id="@ id/edtContact"
android:inputType="number"
android:layout_below="@id/edtBirthdate"/>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@ id/til_email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:endIconMode="clear_text"
app:helperText="Mandatory"
android:layout_marginTop="25dp"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
app:helperTextTextColor="@color/validation"
app:startIconDrawable="@drawable/ic_series"
android:layout_below="@ id/til_birthdate"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Email"
android:id="@ id/edtEmail"
android:inputType="number"
android:layout_below="@id/edtContact"/>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@ id/til_address"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:endIconMode="clear_text"
app:helperText="Mandatory"
android:layout_marginTop="25dp"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
app:helperTextTextColor="@color/validation"
app:startIconDrawable="@drawable/ic_series"
android:layout_below="@ id/til_email"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Address"
android:id="@ id/edtAddress"
android:inputType="number"
android:layout_below="@id/edtEmail"/>
</com.google.android.material.textfield.TextInputLayout>
</LinearLayout>
</ScrollView>
</RelativeLayout>
<TextView
android:id="@ id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@color/background"
android:layout_marginLeft="20dp"
android:text="Appointment"
android:fontFamily="sans-serif-condensed"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="15dp" />
<Button
android:id="@ id/confirmRequestBtn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="@drawable/mybutton"
android:textSize="20dp"
android:text="Confirm Request"
android:textColor="@color/white"
android:layout_marginBottom="5dp"/>
</RelativeLayout>
I Hope this work for you!!