Android Layout Using Constraint Layout, ScrollView & Linear Layout
I wanted to create a form consisting of a button at the bottom of the form. I want only the form to be scrollable and the button to remain stationary. With smaller display it seems to works fine but with larger display, I'm having an issue. Here is my xml layout.
<LinearLayout
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:background="#fff">
<ImageButton
android:id="@+id/back_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="4dp"
android:background="#fff"
android:src="@drawable/ic_keyboard_backspace_black_24dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ScrollView xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
xmlns:android="http://schemas.android.com/apk/res/android">
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/feestructure"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:gravity="start"
android:textStyle="bold"
android:text="@string/request_fee_structure"
android:textColor="@color/colorPrimaryDark"
android:textSize="20sp"
app:layout_constraintStart_toStartOf="parent" />
<TextView
android:id="@+id/school_name_fee"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:gravity="start"
android:text="@string/komal_day_care_service_and_pre_nursery"
android:textColor="@color/colorPrimaryDark"
android:textSize="16sp"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="@+id/feestructure"
app:layout_constraintTop_toBottomOf="@+id/feestructure" />
<EditText
android:id="@+id/name_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:layout_marginEnd="24dp"
android:background="@drawable/ic_form_background"
android:elevation="40dp"
android:hint="@string/name"
android:inputType="text"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@+id/school_name_fee"
app:layout_constraintTop_toBottomOf="@+id/school_name_fee" />
<EditText
android:id="@+id/email_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:background="@drawable/ic_form_background"
android:hint="@string/email"
android:inputType="textEmailAddress"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/name_fee"
app:layout_constraintStart_toStartOf="@+id/name_fee"
app:layout_constraintTop_toBottomOf="@+id/name_fee" />
<EditText
android:id="@+id/phonenumber_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:background="@drawable/ic_form_background"
android:hint="@string/phone_number"
android:inputType="phone"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/email_fee"
app:layout_constraintStart_toStartOf="@+id/email_fee"
app:layout_constraintTop_toBottomOf="@+id/email_fee" />
<EditText
android:id="@+id/address_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:background="@drawable/ic_form_background"
android:hint="@string/address"
android:inputType="text"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/phonenumber_fee"
app:layout_constraintStart_toStartOf="@+id/phonenumber_fee"
app:layout_constraintTop_toBottomOf="@+id/phonenumber_fee" />
<EditText
android:id="@+id/age_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:background="@drawable/ic_form_background"
android:hint="@string/age_of_the_child"
android:inputType="text"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/address_fee"
app:layout_constraintStart_toStartOf="@+id/address_fee"
app:layout_constraintTop_toBottomOf="@+id/address_fee" />
<CheckBox
android:id="@+id/trasportation_fee"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_marginTop="24dp"
app:layout_constraintStart_toStartOf="@+id/age_fee"
app:layout_constraintTop_toBottomOf="@+id/age_fee" />
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:padding="8dp"
android:text="@string/is_transportation_required"
android:textColor="@color/grey"
android:textSize="16sp"
app:layout_constraintBottom_toBottomOf="@+id/trasportation_fee"
app:layout_constraintStart_toEndOf="@+id/trasportation_fee"
app:layout_constraintTop_toTopOf="@+id/trasportation_fee" />
<EditText
android:id="@+id/additional_info_fee"
android:layout_width="0dp"
android:layout_height="100dp"
android:layout_marginTop="24dp"
android:background="@drawable/ic_form_background"
android:hint="@string/additional_information"
android:inputType="text"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/age_fee"
app:layout_constraintStart_toStartOf="@+id/trasportation_fee"
app:layout_constraintTop_toBottomOf="@+id/textView2" />
</android.support.constraint.ConstraintLayout>
<Button
android:id="@+id/requestfeestructure_btn_fee"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:background="@color/colorAccent"
android:padding="4dp"
android:text="@string/request_fee_structure"
android:textColor="@color/white"
android:textSize="14sp"
android:layout_gravity="bottom"/>
</LinearLayout>
</ScrollView>
</LinearLayout>
Here is the screenshot when I run my code.
ON larger Display Google Pixel 2XL
ON smaller Display Google Pixel 2
android android-layout
add a comment |
I wanted to create a form consisting of a button at the bottom of the form. I want only the form to be scrollable and the button to remain stationary. With smaller display it seems to works fine but with larger display, I'm having an issue. Here is my xml layout.
<LinearLayout
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:background="#fff">
<ImageButton
android:id="@+id/back_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="4dp"
android:background="#fff"
android:src="@drawable/ic_keyboard_backspace_black_24dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ScrollView xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
xmlns:android="http://schemas.android.com/apk/res/android">
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/feestructure"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:gravity="start"
android:textStyle="bold"
android:text="@string/request_fee_structure"
android:textColor="@color/colorPrimaryDark"
android:textSize="20sp"
app:layout_constraintStart_toStartOf="parent" />
<TextView
android:id="@+id/school_name_fee"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:gravity="start"
android:text="@string/komal_day_care_service_and_pre_nursery"
android:textColor="@color/colorPrimaryDark"
android:textSize="16sp"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="@+id/feestructure"
app:layout_constraintTop_toBottomOf="@+id/feestructure" />
<EditText
android:id="@+id/name_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:layout_marginEnd="24dp"
android:background="@drawable/ic_form_background"
android:elevation="40dp"
android:hint="@string/name"
android:inputType="text"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@+id/school_name_fee"
app:layout_constraintTop_toBottomOf="@+id/school_name_fee" />
<EditText
android:id="@+id/email_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:background="@drawable/ic_form_background"
android:hint="@string/email"
android:inputType="textEmailAddress"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/name_fee"
app:layout_constraintStart_toStartOf="@+id/name_fee"
app:layout_constraintTop_toBottomOf="@+id/name_fee" />
<EditText
android:id="@+id/phonenumber_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:background="@drawable/ic_form_background"
android:hint="@string/phone_number"
android:inputType="phone"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/email_fee"
app:layout_constraintStart_toStartOf="@+id/email_fee"
app:layout_constraintTop_toBottomOf="@+id/email_fee" />
<EditText
android:id="@+id/address_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:background="@drawable/ic_form_background"
android:hint="@string/address"
android:inputType="text"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/phonenumber_fee"
app:layout_constraintStart_toStartOf="@+id/phonenumber_fee"
app:layout_constraintTop_toBottomOf="@+id/phonenumber_fee" />
<EditText
android:id="@+id/age_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:background="@drawable/ic_form_background"
android:hint="@string/age_of_the_child"
android:inputType="text"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/address_fee"
app:layout_constraintStart_toStartOf="@+id/address_fee"
app:layout_constraintTop_toBottomOf="@+id/address_fee" />
<CheckBox
android:id="@+id/trasportation_fee"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_marginTop="24dp"
app:layout_constraintStart_toStartOf="@+id/age_fee"
app:layout_constraintTop_toBottomOf="@+id/age_fee" />
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:padding="8dp"
android:text="@string/is_transportation_required"
android:textColor="@color/grey"
android:textSize="16sp"
app:layout_constraintBottom_toBottomOf="@+id/trasportation_fee"
app:layout_constraintStart_toEndOf="@+id/trasportation_fee"
app:layout_constraintTop_toTopOf="@+id/trasportation_fee" />
<EditText
android:id="@+id/additional_info_fee"
android:layout_width="0dp"
android:layout_height="100dp"
android:layout_marginTop="24dp"
android:background="@drawable/ic_form_background"
android:hint="@string/additional_information"
android:inputType="text"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/age_fee"
app:layout_constraintStart_toStartOf="@+id/trasportation_fee"
app:layout_constraintTop_toBottomOf="@+id/textView2" />
</android.support.constraint.ConstraintLayout>
<Button
android:id="@+id/requestfeestructure_btn_fee"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:background="@color/colorAccent"
android:padding="4dp"
android:text="@string/request_fee_structure"
android:textColor="@color/white"
android:textSize="14sp"
android:layout_gravity="bottom"/>
</LinearLayout>
</ScrollView>
</LinearLayout>
Here is the screenshot when I run my code.
ON larger Display Google Pixel 2XL
ON smaller Display Google Pixel 2
android android-layout
use fillViewport=true in scrollview
– Karan Mer
Nov 26 '18 at 6:55
add a comment |
I wanted to create a form consisting of a button at the bottom of the form. I want only the form to be scrollable and the button to remain stationary. With smaller display it seems to works fine but with larger display, I'm having an issue. Here is my xml layout.
<LinearLayout
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:background="#fff">
<ImageButton
android:id="@+id/back_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="4dp"
android:background="#fff"
android:src="@drawable/ic_keyboard_backspace_black_24dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ScrollView xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
xmlns:android="http://schemas.android.com/apk/res/android">
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/feestructure"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:gravity="start"
android:textStyle="bold"
android:text="@string/request_fee_structure"
android:textColor="@color/colorPrimaryDark"
android:textSize="20sp"
app:layout_constraintStart_toStartOf="parent" />
<TextView
android:id="@+id/school_name_fee"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:gravity="start"
android:text="@string/komal_day_care_service_and_pre_nursery"
android:textColor="@color/colorPrimaryDark"
android:textSize="16sp"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="@+id/feestructure"
app:layout_constraintTop_toBottomOf="@+id/feestructure" />
<EditText
android:id="@+id/name_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:layout_marginEnd="24dp"
android:background="@drawable/ic_form_background"
android:elevation="40dp"
android:hint="@string/name"
android:inputType="text"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@+id/school_name_fee"
app:layout_constraintTop_toBottomOf="@+id/school_name_fee" />
<EditText
android:id="@+id/email_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:background="@drawable/ic_form_background"
android:hint="@string/email"
android:inputType="textEmailAddress"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/name_fee"
app:layout_constraintStart_toStartOf="@+id/name_fee"
app:layout_constraintTop_toBottomOf="@+id/name_fee" />
<EditText
android:id="@+id/phonenumber_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:background="@drawable/ic_form_background"
android:hint="@string/phone_number"
android:inputType="phone"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/email_fee"
app:layout_constraintStart_toStartOf="@+id/email_fee"
app:layout_constraintTop_toBottomOf="@+id/email_fee" />
<EditText
android:id="@+id/address_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:background="@drawable/ic_form_background"
android:hint="@string/address"
android:inputType="text"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/phonenumber_fee"
app:layout_constraintStart_toStartOf="@+id/phonenumber_fee"
app:layout_constraintTop_toBottomOf="@+id/phonenumber_fee" />
<EditText
android:id="@+id/age_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:background="@drawable/ic_form_background"
android:hint="@string/age_of_the_child"
android:inputType="text"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/address_fee"
app:layout_constraintStart_toStartOf="@+id/address_fee"
app:layout_constraintTop_toBottomOf="@+id/address_fee" />
<CheckBox
android:id="@+id/trasportation_fee"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_marginTop="24dp"
app:layout_constraintStart_toStartOf="@+id/age_fee"
app:layout_constraintTop_toBottomOf="@+id/age_fee" />
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:padding="8dp"
android:text="@string/is_transportation_required"
android:textColor="@color/grey"
android:textSize="16sp"
app:layout_constraintBottom_toBottomOf="@+id/trasportation_fee"
app:layout_constraintStart_toEndOf="@+id/trasportation_fee"
app:layout_constraintTop_toTopOf="@+id/trasportation_fee" />
<EditText
android:id="@+id/additional_info_fee"
android:layout_width="0dp"
android:layout_height="100dp"
android:layout_marginTop="24dp"
android:background="@drawable/ic_form_background"
android:hint="@string/additional_information"
android:inputType="text"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/age_fee"
app:layout_constraintStart_toStartOf="@+id/trasportation_fee"
app:layout_constraintTop_toBottomOf="@+id/textView2" />
</android.support.constraint.ConstraintLayout>
<Button
android:id="@+id/requestfeestructure_btn_fee"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:background="@color/colorAccent"
android:padding="4dp"
android:text="@string/request_fee_structure"
android:textColor="@color/white"
android:textSize="14sp"
android:layout_gravity="bottom"/>
</LinearLayout>
</ScrollView>
</LinearLayout>
Here is the screenshot when I run my code.
ON larger Display Google Pixel 2XL
ON smaller Display Google Pixel 2
android android-layout
I wanted to create a form consisting of a button at the bottom of the form. I want only the form to be scrollable and the button to remain stationary. With smaller display it seems to works fine but with larger display, I'm having an issue. Here is my xml layout.
<LinearLayout
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:background="#fff">
<ImageButton
android:id="@+id/back_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="4dp"
android:background="#fff"
android:src="@drawable/ic_keyboard_backspace_black_24dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ScrollView xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
xmlns:android="http://schemas.android.com/apk/res/android">
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/feestructure"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:gravity="start"
android:textStyle="bold"
android:text="@string/request_fee_structure"
android:textColor="@color/colorPrimaryDark"
android:textSize="20sp"
app:layout_constraintStart_toStartOf="parent" />
<TextView
android:id="@+id/school_name_fee"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:gravity="start"
android:text="@string/komal_day_care_service_and_pre_nursery"
android:textColor="@color/colorPrimaryDark"
android:textSize="16sp"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="@+id/feestructure"
app:layout_constraintTop_toBottomOf="@+id/feestructure" />
<EditText
android:id="@+id/name_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:layout_marginEnd="24dp"
android:background="@drawable/ic_form_background"
android:elevation="40dp"
android:hint="@string/name"
android:inputType="text"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@+id/school_name_fee"
app:layout_constraintTop_toBottomOf="@+id/school_name_fee" />
<EditText
android:id="@+id/email_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:background="@drawable/ic_form_background"
android:hint="@string/email"
android:inputType="textEmailAddress"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/name_fee"
app:layout_constraintStart_toStartOf="@+id/name_fee"
app:layout_constraintTop_toBottomOf="@+id/name_fee" />
<EditText
android:id="@+id/phonenumber_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:background="@drawable/ic_form_background"
android:hint="@string/phone_number"
android:inputType="phone"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/email_fee"
app:layout_constraintStart_toStartOf="@+id/email_fee"
app:layout_constraintTop_toBottomOf="@+id/email_fee" />
<EditText
android:id="@+id/address_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:background="@drawable/ic_form_background"
android:hint="@string/address"
android:inputType="text"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/phonenumber_fee"
app:layout_constraintStart_toStartOf="@+id/phonenumber_fee"
app:layout_constraintTop_toBottomOf="@+id/phonenumber_fee" />
<EditText
android:id="@+id/age_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:background="@drawable/ic_form_background"
android:hint="@string/age_of_the_child"
android:inputType="text"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/address_fee"
app:layout_constraintStart_toStartOf="@+id/address_fee"
app:layout_constraintTop_toBottomOf="@+id/address_fee" />
<CheckBox
android:id="@+id/trasportation_fee"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_marginTop="24dp"
app:layout_constraintStart_toStartOf="@+id/age_fee"
app:layout_constraintTop_toBottomOf="@+id/age_fee" />
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:padding="8dp"
android:text="@string/is_transportation_required"
android:textColor="@color/grey"
android:textSize="16sp"
app:layout_constraintBottom_toBottomOf="@+id/trasportation_fee"
app:layout_constraintStart_toEndOf="@+id/trasportation_fee"
app:layout_constraintTop_toTopOf="@+id/trasportation_fee" />
<EditText
android:id="@+id/additional_info_fee"
android:layout_width="0dp"
android:layout_height="100dp"
android:layout_marginTop="24dp"
android:background="@drawable/ic_form_background"
android:hint="@string/additional_information"
android:inputType="text"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/age_fee"
app:layout_constraintStart_toStartOf="@+id/trasportation_fee"
app:layout_constraintTop_toBottomOf="@+id/textView2" />
</android.support.constraint.ConstraintLayout>
<Button
android:id="@+id/requestfeestructure_btn_fee"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:background="@color/colorAccent"
android:padding="4dp"
android:text="@string/request_fee_structure"
android:textColor="@color/white"
android:textSize="14sp"
android:layout_gravity="bottom"/>
</LinearLayout>
</ScrollView>
</LinearLayout>
Here is the screenshot when I run my code.
ON larger Display Google Pixel 2XL
ON smaller Display Google Pixel 2
android android-layout
android android-layout
asked Nov 26 '18 at 6:52
R.MaharjanR.Maharjan
166
166
use fillViewport=true in scrollview
– Karan Mer
Nov 26 '18 at 6:55
add a comment |
use fillViewport=true in scrollview
– Karan Mer
Nov 26 '18 at 6:55
use fillViewport=true in scrollview
– Karan Mer
Nov 26 '18 at 6:55
use fillViewport=true in scrollview
– Karan Mer
Nov 26 '18 at 6:55
add a comment |
5 Answers
5
active
oldest
votes
Just Add FrameLayout and move button outside scrollview, Hope it helps
<LinearLayout
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:background="#fff">
<ImageButton
android:id="@+id/back_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="4dp"
android:background="#fff"
android:src="@drawable/abc_btn_check_to_on_mtrl_000"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ScrollView xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
xmlns:android="http://schemas.android.com/apk/res/android">
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/feestructure"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:gravity="start"
android:textStyle="bold"
android:text="@string/request_fee_structure"
android:textColor="@color/colorPrimaryDark"
android:textSize="20sp"
app:layout_constraintStart_toStartOf="parent" />
<TextView
android:id="@+id/school_name_fee"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:gravity="start"
android:text="@string/komal_day_care_service_and_pre_nursery"
android:textColor="@color/colorPrimaryDark"
android:textSize="16sp"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="@+id/feestructure"
app:layout_constraintTop_toBottomOf="@+id/feestructure" />
<EditText
android:id="@+id/name_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:layout_marginEnd="24dp"
android:background="@drawable/ic_form_background"
android:elevation="40dp"
android:hint="@string/name"
android:inputType="text"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@+id/school_name_fee"
app:layout_constraintTop_toBottomOf="@+id/school_name_fee" />
<EditText
android:id="@+id/email_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:background="@drawable/ic_form_background"
android:hint="@string/email"
android:inputType="textEmailAddress"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/name_fee"
app:layout_constraintStart_toStartOf="@+id/name_fee"
app:layout_constraintTop_toBottomOf="@+id/name_fee" />
<EditText
android:id="@+id/phonenumber_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:background="@drawable/ic_form_background"
android:hint="@string/phone_number"
android:inputType="phone"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/email_fee"
app:layout_constraintStart_toStartOf="@+id/email_fee"
app:layout_constraintTop_toBottomOf="@+id/email_fee" />
<EditText
android:id="@+id/address_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:background="@drawable/ic_form_background"
android:hint="@string/address"
android:inputType="text"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/phonenumber_fee"
app:layout_constraintStart_toStartOf="@+id/phonenumber_fee"
app:layout_constraintTop_toBottomOf="@+id/phonenumber_fee" />
<EditText
android:id="@+id/age_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:background="@drawable/ic_form_background"
android:hint="@string/age_of_the_child"
android:inputType="text"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/address_fee"
app:layout_constraintStart_toStartOf="@+id/address_fee"
app:layout_constraintTop_toBottomOf="@+id/address_fee" />
<CheckBox
android:id="@+id/trasportation_fee"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_marginTop="24dp"
app:layout_constraintStart_toStartOf="@+id/age_fee"
app:layout_constraintTop_toBottomOf="@+id/age_fee" />
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:padding="8dp"
android:text="@string/is_transportation_required"
android:textColor="@color/grey"
android:textSize="16sp"
app:layout_constraintBottom_toBottomOf="@+id/trasportation_fee"
app:layout_constraintStart_toEndOf="@+id/trasportation_fee"
app:layout_constraintTop_toTopOf="@+id/trasportation_fee" />
<EditText
android:id="@+id/additional_info_fee"
android:layout_width="0dp"
android:layout_height="100dp"
android:layout_marginTop="24dp"
android:background="@drawable/ic_form_background"
android:hint="@string/additional_information"
android:inputType="text"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/age_fee"
app:layout_constraintStart_toStartOf="@+id/trasportation_fee"
app:layout_constraintTop_toBottomOf="@+id/textView2" />
</android.support.constraint.ConstraintLayout>
</LinearLayout>
</ScrollView>
<Button
android:id="@+id/requestfeestructure_btn_fee"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:background="@color/abc_background_cache_hint_selector_material_light"
android:padding="4dp"
android:text="Yashwant"
android:textColor="@color/design_default_color_primary"
android:textSize="14sp"
android:layout_gravity="bottom"/>
</FrameLayout>
add a comment |
Add fillViewport=true in scrollview as:
<ScrollView xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
xmlns:android="http://schemas.android.com/apk/res/android"></ScrollView>
How android:fillViewport works?
When set to true, this attribute causes the scroll view’s child to expand to the height of the ScrollView if needed. But, when the child is taller than the ScrollView, the attribute has no effect.
add a comment |
<LinearLayout>
<ScrollView/>
<ImageButton/>
</LinearLayout>
keep above structure and add android:layout_weight="1"
in ScrollView
add a comment |
Button needs to be at the bottom right? So can you use ConstraintLayout instead of LinearLayout as the paretn layout and then set button at the bottom of parent using contraints
I have changed backgrounds,strings and some drawables to get a solution quickly as i tried this layout in my project.Please make necessary changes and try this layout
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#fff">
<ImageButton
android:id="@+id/back_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="4dp"
android:background="#fff"
android:src="@drawable/ic_athlete_indicator"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="0dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/back_btn"
android:layout_height="wrap_content">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<androidx.constraintlayout.widget.ConstraintLayout 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="wrap_content">
<TextView
android:id="@+id/feestructure"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:gravity="start"
android:text="request_fee_structure"
android:textColor="@color/colorPrimaryDark"
android:textSize="20sp"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/school_name_fee"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:gravity="start"
android:text="komal_day_care_service_and_pre_nursery"
android:textColor="@color/colorPrimaryDark"
android:textSize="16sp"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="@+id/feestructure"
app:layout_constraintTop_toBottomOf="@+id/feestructure" />
<EditText
android:id="@+id/name_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginEnd="24dp"
android:layout_marginTop="24dp"
android:background="@drawable/text_field"
android:elevation="40dp"
android:hint="name"
android:inputType="text"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@+id/school_name_fee"
app:layout_constraintTop_toBottomOf="@+id/school_name_fee" />
<EditText
android:id="@+id/email_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:background="@drawable/text_field"
android:hint="email"
android:inputType="textEmailAddress"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/name_fee"
app:layout_constraintStart_toStartOf="@+id/name_fee"
app:layout_constraintTop_toBottomOf="@+id/name_fee" />
<EditText
android:id="@+id/phonenumber_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:background="@drawable/text_field"
android:hint="phone_number"
android:inputType="phone"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/email_fee"
app:layout_constraintStart_toStartOf="@+id/email_fee"
app:layout_constraintTop_toBottomOf="@+id/email_fee" />
<EditText
android:id="@+id/address_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:background="@drawable/text_field"
android:hint="address"
android:inputType="text"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/phonenumber_fee"
app:layout_constraintStart_toStartOf="@+id/phonenumber_fee"
app:layout_constraintTop_toBottomOf="@+id/phonenumber_fee" />
<EditText
android:id="@+id/age_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:background="@drawable/text_field"
android:hint="age_of_the_child"
android:inputType="text"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/address_fee"
app:layout_constraintStart_toStartOf="@+id/address_fee"
app:layout_constraintTop_toBottomOf="@+id/address_fee" />
<CheckBox
android:id="@+id/trasportation_fee"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_marginTop="24dp"
app:layout_constraintStart_toStartOf="@+id/age_fee"
app:layout_constraintTop_toBottomOf="@+id/age_fee" />
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:padding="8dp"
android:text="is_transportation_required"
android:textColor="@color/blue_e72b3990"
android:textSize="16sp"
app:layout_constraintBottom_toBottomOf="@+id/trasportation_fee"
app:layout_constraintStart_toEndOf="@+id/trasportation_fee"
app:layout_constraintTop_toTopOf="@+id/trasportation_fee" />
<EditText
android:id="@+id/additional_info_fee"
android:layout_width="0dp"
android:layout_height="100dp"
android:layout_marginTop="24dp"
android:background="@drawable/text_field"
android:hint="additional_information"
android:inputType="text"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/age_fee"
app:layout_constraintStart_toStartOf="@+id/trasportation_fee"
app:layout_constraintTop_toBottomOf="@+id/textView2" />
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
</ScrollView>
<Button
android:id="@+id/requestfeestructure_btn_fee"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:background="@color/colorAccent"
android:padding="4dp"
app:layout_constraintBottom_toBottomOf="parent"
android:text="Request fee"
android:textColor="@color/blue_e72b3990"
android:textSize="14sp" />
</androidx.constraintlayout.widget.ConstraintLayout>
Actually, i have tried your layout. It contains lot of nesting which makes it more complex.
– ABr
Nov 26 '18 at 7:48
add a comment |
Try this, hope it will work.
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
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:background="#fff">
<ImageButton
android:id="@+id/back_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:background="#fff"
android:src="@drawable/ic_keyboard_backspace_black_24dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp"
android:fillViewport="true"
app:layout_constraintBottom_toTopOf="@+id/requestfeestructure_btn_fee"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/back_btn"
app:layout_constraintVertical_bias="0.0">
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/feestructure"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:gravity="start"
android:text="@string/request_fee_structure"
android:textColor="@color/colorPrimaryDark"
android:textSize="20sp"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent" />
<TextView
android:id="@+id/school_name_fee"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:gravity="start"
android:text="@string/komal_day_care_service_and_pre_nursery"
android:textColor="@color/colorPrimaryDark"
android:textSize="16sp"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="@+id/feestructure"
app:layout_constraintTop_toBottomOf="@+id/feestructure" />
<EditText
android:id="@+id/name_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:layout_marginEnd="24dp"
android:background="@drawable/ic_form_background"
android:elevation="40dp"
android:hint="@string/name"
android:inputType="text"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@+id/school_name_fee"
app:layout_constraintTop_toBottomOf="@+id/school_name_fee" />
<EditText
android:id="@+id/email_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:background="@drawable/ic_form_background"
android:hint="@string/email"
android:inputType="textEmailAddress"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/name_fee"
app:layout_constraintStart_toStartOf="@+id/name_fee"
app:layout_constraintTop_toBottomOf="@+id/name_fee" />
<EditText
android:id="@+id/phonenumber_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:background="@drawable/ic_form_background"
android:hint="@string/phone_number"
android:inputType="phone"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/email_fee"
app:layout_constraintStart_toStartOf="@+id/email_fee"
app:layout_constraintTop_toBottomOf="@+id/email_fee" />
<EditText
android:id="@+id/address_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:background="@drawable/ic_form_background"
android:hint="@string/address"
android:inputType="text"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/phonenumber_fee"
app:layout_constraintStart_toStartOf="@+id/phonenumber_fee"
app:layout_constraintTop_toBottomOf="@+id/phonenumber_fee" />
<EditText
android:id="@+id/age_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:background="@drawable/ic_form_background"
android:hint="@string/age_of_the_child"
android:inputType="text"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/address_fee"
app:layout_constraintStart_toStartOf="@+id/address_fee"
app:layout_constraintTop_toBottomOf="@+id/address_fee" />
<CheckBox
android:id="@+id/trasportation_fee"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_marginTop="24dp"
app:layout_constraintStart_toStartOf="@+id/age_fee"
app:layout_constraintTop_toBottomOf="@+id/age_fee" />
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:padding="8dp"
android:text="@string/is_transportation_required"
android:textColor="@color/grey"
android:textSize="16sp"
app:layout_constraintBottom_toBottomOf="@+id/trasportation_fee"
app:layout_constraintStart_toEndOf="@+id/trasportation_fee"
app:layout_constraintTop_toTopOf="@+id/trasportation_fee" />
<EditText
android:id="@+id/additional_info_fee"
android:layout_width="0dp"
android:layout_height="100dp"
android:layout_marginTop="24dp"
android:background="@drawable/ic_form_background"
android:hint="@string/additional_information"
android:inputType="text"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/age_fee"
app:layout_constraintStart_toStartOf="@+id/trasportation_fee"
app:layout_constraintTop_toBottomOf="@+id/textView2" />
</android.support.constraint.ConstraintLayout>
</android.support.v4.widget.NestedScrollView>
<Button
android:id="@+id/requestfeestructure_btn_fee"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginBottom="8dp"
android:background="@color/colorAccent"
android:padding="4dp"
android:text="@string/request_fee_structure"
android:textColor="@color/white"
android:textSize="14sp"
app:layout_constraintBottom_toBottomOf="parent" />
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53476009%2fandroid-layout-using-constraint-layout-scrollview-linear-layout%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
5 Answers
5
active
oldest
votes
5 Answers
5
active
oldest
votes
active
oldest
votes
active
oldest
votes
Just Add FrameLayout and move button outside scrollview, Hope it helps
<LinearLayout
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:background="#fff">
<ImageButton
android:id="@+id/back_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="4dp"
android:background="#fff"
android:src="@drawable/abc_btn_check_to_on_mtrl_000"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ScrollView xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
xmlns:android="http://schemas.android.com/apk/res/android">
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/feestructure"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:gravity="start"
android:textStyle="bold"
android:text="@string/request_fee_structure"
android:textColor="@color/colorPrimaryDark"
android:textSize="20sp"
app:layout_constraintStart_toStartOf="parent" />
<TextView
android:id="@+id/school_name_fee"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:gravity="start"
android:text="@string/komal_day_care_service_and_pre_nursery"
android:textColor="@color/colorPrimaryDark"
android:textSize="16sp"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="@+id/feestructure"
app:layout_constraintTop_toBottomOf="@+id/feestructure" />
<EditText
android:id="@+id/name_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:layout_marginEnd="24dp"
android:background="@drawable/ic_form_background"
android:elevation="40dp"
android:hint="@string/name"
android:inputType="text"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@+id/school_name_fee"
app:layout_constraintTop_toBottomOf="@+id/school_name_fee" />
<EditText
android:id="@+id/email_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:background="@drawable/ic_form_background"
android:hint="@string/email"
android:inputType="textEmailAddress"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/name_fee"
app:layout_constraintStart_toStartOf="@+id/name_fee"
app:layout_constraintTop_toBottomOf="@+id/name_fee" />
<EditText
android:id="@+id/phonenumber_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:background="@drawable/ic_form_background"
android:hint="@string/phone_number"
android:inputType="phone"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/email_fee"
app:layout_constraintStart_toStartOf="@+id/email_fee"
app:layout_constraintTop_toBottomOf="@+id/email_fee" />
<EditText
android:id="@+id/address_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:background="@drawable/ic_form_background"
android:hint="@string/address"
android:inputType="text"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/phonenumber_fee"
app:layout_constraintStart_toStartOf="@+id/phonenumber_fee"
app:layout_constraintTop_toBottomOf="@+id/phonenumber_fee" />
<EditText
android:id="@+id/age_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:background="@drawable/ic_form_background"
android:hint="@string/age_of_the_child"
android:inputType="text"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/address_fee"
app:layout_constraintStart_toStartOf="@+id/address_fee"
app:layout_constraintTop_toBottomOf="@+id/address_fee" />
<CheckBox
android:id="@+id/trasportation_fee"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_marginTop="24dp"
app:layout_constraintStart_toStartOf="@+id/age_fee"
app:layout_constraintTop_toBottomOf="@+id/age_fee" />
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:padding="8dp"
android:text="@string/is_transportation_required"
android:textColor="@color/grey"
android:textSize="16sp"
app:layout_constraintBottom_toBottomOf="@+id/trasportation_fee"
app:layout_constraintStart_toEndOf="@+id/trasportation_fee"
app:layout_constraintTop_toTopOf="@+id/trasportation_fee" />
<EditText
android:id="@+id/additional_info_fee"
android:layout_width="0dp"
android:layout_height="100dp"
android:layout_marginTop="24dp"
android:background="@drawable/ic_form_background"
android:hint="@string/additional_information"
android:inputType="text"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/age_fee"
app:layout_constraintStart_toStartOf="@+id/trasportation_fee"
app:layout_constraintTop_toBottomOf="@+id/textView2" />
</android.support.constraint.ConstraintLayout>
</LinearLayout>
</ScrollView>
<Button
android:id="@+id/requestfeestructure_btn_fee"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:background="@color/abc_background_cache_hint_selector_material_light"
android:padding="4dp"
android:text="Yashwant"
android:textColor="@color/design_default_color_primary"
android:textSize="14sp"
android:layout_gravity="bottom"/>
</FrameLayout>
add a comment |
Just Add FrameLayout and move button outside scrollview, Hope it helps
<LinearLayout
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:background="#fff">
<ImageButton
android:id="@+id/back_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="4dp"
android:background="#fff"
android:src="@drawable/abc_btn_check_to_on_mtrl_000"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ScrollView xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
xmlns:android="http://schemas.android.com/apk/res/android">
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/feestructure"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:gravity="start"
android:textStyle="bold"
android:text="@string/request_fee_structure"
android:textColor="@color/colorPrimaryDark"
android:textSize="20sp"
app:layout_constraintStart_toStartOf="parent" />
<TextView
android:id="@+id/school_name_fee"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:gravity="start"
android:text="@string/komal_day_care_service_and_pre_nursery"
android:textColor="@color/colorPrimaryDark"
android:textSize="16sp"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="@+id/feestructure"
app:layout_constraintTop_toBottomOf="@+id/feestructure" />
<EditText
android:id="@+id/name_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:layout_marginEnd="24dp"
android:background="@drawable/ic_form_background"
android:elevation="40dp"
android:hint="@string/name"
android:inputType="text"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@+id/school_name_fee"
app:layout_constraintTop_toBottomOf="@+id/school_name_fee" />
<EditText
android:id="@+id/email_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:background="@drawable/ic_form_background"
android:hint="@string/email"
android:inputType="textEmailAddress"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/name_fee"
app:layout_constraintStart_toStartOf="@+id/name_fee"
app:layout_constraintTop_toBottomOf="@+id/name_fee" />
<EditText
android:id="@+id/phonenumber_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:background="@drawable/ic_form_background"
android:hint="@string/phone_number"
android:inputType="phone"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/email_fee"
app:layout_constraintStart_toStartOf="@+id/email_fee"
app:layout_constraintTop_toBottomOf="@+id/email_fee" />
<EditText
android:id="@+id/address_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:background="@drawable/ic_form_background"
android:hint="@string/address"
android:inputType="text"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/phonenumber_fee"
app:layout_constraintStart_toStartOf="@+id/phonenumber_fee"
app:layout_constraintTop_toBottomOf="@+id/phonenumber_fee" />
<EditText
android:id="@+id/age_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:background="@drawable/ic_form_background"
android:hint="@string/age_of_the_child"
android:inputType="text"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/address_fee"
app:layout_constraintStart_toStartOf="@+id/address_fee"
app:layout_constraintTop_toBottomOf="@+id/address_fee" />
<CheckBox
android:id="@+id/trasportation_fee"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_marginTop="24dp"
app:layout_constraintStart_toStartOf="@+id/age_fee"
app:layout_constraintTop_toBottomOf="@+id/age_fee" />
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:padding="8dp"
android:text="@string/is_transportation_required"
android:textColor="@color/grey"
android:textSize="16sp"
app:layout_constraintBottom_toBottomOf="@+id/trasportation_fee"
app:layout_constraintStart_toEndOf="@+id/trasportation_fee"
app:layout_constraintTop_toTopOf="@+id/trasportation_fee" />
<EditText
android:id="@+id/additional_info_fee"
android:layout_width="0dp"
android:layout_height="100dp"
android:layout_marginTop="24dp"
android:background="@drawable/ic_form_background"
android:hint="@string/additional_information"
android:inputType="text"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/age_fee"
app:layout_constraintStart_toStartOf="@+id/trasportation_fee"
app:layout_constraintTop_toBottomOf="@+id/textView2" />
</android.support.constraint.ConstraintLayout>
</LinearLayout>
</ScrollView>
<Button
android:id="@+id/requestfeestructure_btn_fee"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:background="@color/abc_background_cache_hint_selector_material_light"
android:padding="4dp"
android:text="Yashwant"
android:textColor="@color/design_default_color_primary"
android:textSize="14sp"
android:layout_gravity="bottom"/>
</FrameLayout>
add a comment |
Just Add FrameLayout and move button outside scrollview, Hope it helps
<LinearLayout
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:background="#fff">
<ImageButton
android:id="@+id/back_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="4dp"
android:background="#fff"
android:src="@drawable/abc_btn_check_to_on_mtrl_000"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ScrollView xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
xmlns:android="http://schemas.android.com/apk/res/android">
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/feestructure"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:gravity="start"
android:textStyle="bold"
android:text="@string/request_fee_structure"
android:textColor="@color/colorPrimaryDark"
android:textSize="20sp"
app:layout_constraintStart_toStartOf="parent" />
<TextView
android:id="@+id/school_name_fee"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:gravity="start"
android:text="@string/komal_day_care_service_and_pre_nursery"
android:textColor="@color/colorPrimaryDark"
android:textSize="16sp"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="@+id/feestructure"
app:layout_constraintTop_toBottomOf="@+id/feestructure" />
<EditText
android:id="@+id/name_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:layout_marginEnd="24dp"
android:background="@drawable/ic_form_background"
android:elevation="40dp"
android:hint="@string/name"
android:inputType="text"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@+id/school_name_fee"
app:layout_constraintTop_toBottomOf="@+id/school_name_fee" />
<EditText
android:id="@+id/email_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:background="@drawable/ic_form_background"
android:hint="@string/email"
android:inputType="textEmailAddress"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/name_fee"
app:layout_constraintStart_toStartOf="@+id/name_fee"
app:layout_constraintTop_toBottomOf="@+id/name_fee" />
<EditText
android:id="@+id/phonenumber_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:background="@drawable/ic_form_background"
android:hint="@string/phone_number"
android:inputType="phone"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/email_fee"
app:layout_constraintStart_toStartOf="@+id/email_fee"
app:layout_constraintTop_toBottomOf="@+id/email_fee" />
<EditText
android:id="@+id/address_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:background="@drawable/ic_form_background"
android:hint="@string/address"
android:inputType="text"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/phonenumber_fee"
app:layout_constraintStart_toStartOf="@+id/phonenumber_fee"
app:layout_constraintTop_toBottomOf="@+id/phonenumber_fee" />
<EditText
android:id="@+id/age_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:background="@drawable/ic_form_background"
android:hint="@string/age_of_the_child"
android:inputType="text"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/address_fee"
app:layout_constraintStart_toStartOf="@+id/address_fee"
app:layout_constraintTop_toBottomOf="@+id/address_fee" />
<CheckBox
android:id="@+id/trasportation_fee"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_marginTop="24dp"
app:layout_constraintStart_toStartOf="@+id/age_fee"
app:layout_constraintTop_toBottomOf="@+id/age_fee" />
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:padding="8dp"
android:text="@string/is_transportation_required"
android:textColor="@color/grey"
android:textSize="16sp"
app:layout_constraintBottom_toBottomOf="@+id/trasportation_fee"
app:layout_constraintStart_toEndOf="@+id/trasportation_fee"
app:layout_constraintTop_toTopOf="@+id/trasportation_fee" />
<EditText
android:id="@+id/additional_info_fee"
android:layout_width="0dp"
android:layout_height="100dp"
android:layout_marginTop="24dp"
android:background="@drawable/ic_form_background"
android:hint="@string/additional_information"
android:inputType="text"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/age_fee"
app:layout_constraintStart_toStartOf="@+id/trasportation_fee"
app:layout_constraintTop_toBottomOf="@+id/textView2" />
</android.support.constraint.ConstraintLayout>
</LinearLayout>
</ScrollView>
<Button
android:id="@+id/requestfeestructure_btn_fee"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:background="@color/abc_background_cache_hint_selector_material_light"
android:padding="4dp"
android:text="Yashwant"
android:textColor="@color/design_default_color_primary"
android:textSize="14sp"
android:layout_gravity="bottom"/>
</FrameLayout>
Just Add FrameLayout and move button outside scrollview, Hope it helps
<LinearLayout
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:background="#fff">
<ImageButton
android:id="@+id/back_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="4dp"
android:background="#fff"
android:src="@drawable/abc_btn_check_to_on_mtrl_000"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ScrollView xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
xmlns:android="http://schemas.android.com/apk/res/android">
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/feestructure"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:gravity="start"
android:textStyle="bold"
android:text="@string/request_fee_structure"
android:textColor="@color/colorPrimaryDark"
android:textSize="20sp"
app:layout_constraintStart_toStartOf="parent" />
<TextView
android:id="@+id/school_name_fee"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:gravity="start"
android:text="@string/komal_day_care_service_and_pre_nursery"
android:textColor="@color/colorPrimaryDark"
android:textSize="16sp"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="@+id/feestructure"
app:layout_constraintTop_toBottomOf="@+id/feestructure" />
<EditText
android:id="@+id/name_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:layout_marginEnd="24dp"
android:background="@drawable/ic_form_background"
android:elevation="40dp"
android:hint="@string/name"
android:inputType="text"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@+id/school_name_fee"
app:layout_constraintTop_toBottomOf="@+id/school_name_fee" />
<EditText
android:id="@+id/email_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:background="@drawable/ic_form_background"
android:hint="@string/email"
android:inputType="textEmailAddress"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/name_fee"
app:layout_constraintStart_toStartOf="@+id/name_fee"
app:layout_constraintTop_toBottomOf="@+id/name_fee" />
<EditText
android:id="@+id/phonenumber_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:background="@drawable/ic_form_background"
android:hint="@string/phone_number"
android:inputType="phone"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/email_fee"
app:layout_constraintStart_toStartOf="@+id/email_fee"
app:layout_constraintTop_toBottomOf="@+id/email_fee" />
<EditText
android:id="@+id/address_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:background="@drawable/ic_form_background"
android:hint="@string/address"
android:inputType="text"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/phonenumber_fee"
app:layout_constraintStart_toStartOf="@+id/phonenumber_fee"
app:layout_constraintTop_toBottomOf="@+id/phonenumber_fee" />
<EditText
android:id="@+id/age_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:background="@drawable/ic_form_background"
android:hint="@string/age_of_the_child"
android:inputType="text"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/address_fee"
app:layout_constraintStart_toStartOf="@+id/address_fee"
app:layout_constraintTop_toBottomOf="@+id/address_fee" />
<CheckBox
android:id="@+id/trasportation_fee"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_marginTop="24dp"
app:layout_constraintStart_toStartOf="@+id/age_fee"
app:layout_constraintTop_toBottomOf="@+id/age_fee" />
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:padding="8dp"
android:text="@string/is_transportation_required"
android:textColor="@color/grey"
android:textSize="16sp"
app:layout_constraintBottom_toBottomOf="@+id/trasportation_fee"
app:layout_constraintStart_toEndOf="@+id/trasportation_fee"
app:layout_constraintTop_toTopOf="@+id/trasportation_fee" />
<EditText
android:id="@+id/additional_info_fee"
android:layout_width="0dp"
android:layout_height="100dp"
android:layout_marginTop="24dp"
android:background="@drawable/ic_form_background"
android:hint="@string/additional_information"
android:inputType="text"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/age_fee"
app:layout_constraintStart_toStartOf="@+id/trasportation_fee"
app:layout_constraintTop_toBottomOf="@+id/textView2" />
</android.support.constraint.ConstraintLayout>
</LinearLayout>
</ScrollView>
<Button
android:id="@+id/requestfeestructure_btn_fee"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:background="@color/abc_background_cache_hint_selector_material_light"
android:padding="4dp"
android:text="Yashwant"
android:textColor="@color/design_default_color_primary"
android:textSize="14sp"
android:layout_gravity="bottom"/>
</FrameLayout>
answered Nov 26 '18 at 8:02
Yashwant SinghYashwant Singh
822
822
add a comment |
add a comment |
Add fillViewport=true in scrollview as:
<ScrollView xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
xmlns:android="http://schemas.android.com/apk/res/android"></ScrollView>
How android:fillViewport works?
When set to true, this attribute causes the scroll view’s child to expand to the height of the ScrollView if needed. But, when the child is taller than the ScrollView, the attribute has no effect.
add a comment |
Add fillViewport=true in scrollview as:
<ScrollView xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
xmlns:android="http://schemas.android.com/apk/res/android"></ScrollView>
How android:fillViewport works?
When set to true, this attribute causes the scroll view’s child to expand to the height of the ScrollView if needed. But, when the child is taller than the ScrollView, the attribute has no effect.
add a comment |
Add fillViewport=true in scrollview as:
<ScrollView xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
xmlns:android="http://schemas.android.com/apk/res/android"></ScrollView>
How android:fillViewport works?
When set to true, this attribute causes the scroll view’s child to expand to the height of the ScrollView if needed. But, when the child is taller than the ScrollView, the attribute has no effect.
Add fillViewport=true in scrollview as:
<ScrollView xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
xmlns:android="http://schemas.android.com/apk/res/android"></ScrollView>
How android:fillViewport works?
When set to true, this attribute causes the scroll view’s child to expand to the height of the ScrollView if needed. But, when the child is taller than the ScrollView, the attribute has no effect.
answered Nov 26 '18 at 7:22
jaedejaede
15410
15410
add a comment |
add a comment |
<LinearLayout>
<ScrollView/>
<ImageButton/>
</LinearLayout>
keep above structure and add android:layout_weight="1"
in ScrollView
add a comment |
<LinearLayout>
<ScrollView/>
<ImageButton/>
</LinearLayout>
keep above structure and add android:layout_weight="1"
in ScrollView
add a comment |
<LinearLayout>
<ScrollView/>
<ImageButton/>
</LinearLayout>
keep above structure and add android:layout_weight="1"
in ScrollView
<LinearLayout>
<ScrollView/>
<ImageButton/>
</LinearLayout>
keep above structure and add android:layout_weight="1"
in ScrollView
answered Nov 26 '18 at 7:23
Bineesh P BabuBineesh P Babu
8210
8210
add a comment |
add a comment |
Button needs to be at the bottom right? So can you use ConstraintLayout instead of LinearLayout as the paretn layout and then set button at the bottom of parent using contraints
I have changed backgrounds,strings and some drawables to get a solution quickly as i tried this layout in my project.Please make necessary changes and try this layout
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#fff">
<ImageButton
android:id="@+id/back_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="4dp"
android:background="#fff"
android:src="@drawable/ic_athlete_indicator"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="0dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/back_btn"
android:layout_height="wrap_content">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<androidx.constraintlayout.widget.ConstraintLayout 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="wrap_content">
<TextView
android:id="@+id/feestructure"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:gravity="start"
android:text="request_fee_structure"
android:textColor="@color/colorPrimaryDark"
android:textSize="20sp"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/school_name_fee"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:gravity="start"
android:text="komal_day_care_service_and_pre_nursery"
android:textColor="@color/colorPrimaryDark"
android:textSize="16sp"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="@+id/feestructure"
app:layout_constraintTop_toBottomOf="@+id/feestructure" />
<EditText
android:id="@+id/name_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginEnd="24dp"
android:layout_marginTop="24dp"
android:background="@drawable/text_field"
android:elevation="40dp"
android:hint="name"
android:inputType="text"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@+id/school_name_fee"
app:layout_constraintTop_toBottomOf="@+id/school_name_fee" />
<EditText
android:id="@+id/email_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:background="@drawable/text_field"
android:hint="email"
android:inputType="textEmailAddress"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/name_fee"
app:layout_constraintStart_toStartOf="@+id/name_fee"
app:layout_constraintTop_toBottomOf="@+id/name_fee" />
<EditText
android:id="@+id/phonenumber_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:background="@drawable/text_field"
android:hint="phone_number"
android:inputType="phone"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/email_fee"
app:layout_constraintStart_toStartOf="@+id/email_fee"
app:layout_constraintTop_toBottomOf="@+id/email_fee" />
<EditText
android:id="@+id/address_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:background="@drawable/text_field"
android:hint="address"
android:inputType="text"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/phonenumber_fee"
app:layout_constraintStart_toStartOf="@+id/phonenumber_fee"
app:layout_constraintTop_toBottomOf="@+id/phonenumber_fee" />
<EditText
android:id="@+id/age_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:background="@drawable/text_field"
android:hint="age_of_the_child"
android:inputType="text"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/address_fee"
app:layout_constraintStart_toStartOf="@+id/address_fee"
app:layout_constraintTop_toBottomOf="@+id/address_fee" />
<CheckBox
android:id="@+id/trasportation_fee"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_marginTop="24dp"
app:layout_constraintStart_toStartOf="@+id/age_fee"
app:layout_constraintTop_toBottomOf="@+id/age_fee" />
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:padding="8dp"
android:text="is_transportation_required"
android:textColor="@color/blue_e72b3990"
android:textSize="16sp"
app:layout_constraintBottom_toBottomOf="@+id/trasportation_fee"
app:layout_constraintStart_toEndOf="@+id/trasportation_fee"
app:layout_constraintTop_toTopOf="@+id/trasportation_fee" />
<EditText
android:id="@+id/additional_info_fee"
android:layout_width="0dp"
android:layout_height="100dp"
android:layout_marginTop="24dp"
android:background="@drawable/text_field"
android:hint="additional_information"
android:inputType="text"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/age_fee"
app:layout_constraintStart_toStartOf="@+id/trasportation_fee"
app:layout_constraintTop_toBottomOf="@+id/textView2" />
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
</ScrollView>
<Button
android:id="@+id/requestfeestructure_btn_fee"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:background="@color/colorAccent"
android:padding="4dp"
app:layout_constraintBottom_toBottomOf="parent"
android:text="Request fee"
android:textColor="@color/blue_e72b3990"
android:textSize="14sp" />
</androidx.constraintlayout.widget.ConstraintLayout>
Actually, i have tried your layout. It contains lot of nesting which makes it more complex.
– ABr
Nov 26 '18 at 7:48
add a comment |
Button needs to be at the bottom right? So can you use ConstraintLayout instead of LinearLayout as the paretn layout and then set button at the bottom of parent using contraints
I have changed backgrounds,strings and some drawables to get a solution quickly as i tried this layout in my project.Please make necessary changes and try this layout
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#fff">
<ImageButton
android:id="@+id/back_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="4dp"
android:background="#fff"
android:src="@drawable/ic_athlete_indicator"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="0dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/back_btn"
android:layout_height="wrap_content">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<androidx.constraintlayout.widget.ConstraintLayout 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="wrap_content">
<TextView
android:id="@+id/feestructure"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:gravity="start"
android:text="request_fee_structure"
android:textColor="@color/colorPrimaryDark"
android:textSize="20sp"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/school_name_fee"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:gravity="start"
android:text="komal_day_care_service_and_pre_nursery"
android:textColor="@color/colorPrimaryDark"
android:textSize="16sp"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="@+id/feestructure"
app:layout_constraintTop_toBottomOf="@+id/feestructure" />
<EditText
android:id="@+id/name_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginEnd="24dp"
android:layout_marginTop="24dp"
android:background="@drawable/text_field"
android:elevation="40dp"
android:hint="name"
android:inputType="text"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@+id/school_name_fee"
app:layout_constraintTop_toBottomOf="@+id/school_name_fee" />
<EditText
android:id="@+id/email_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:background="@drawable/text_field"
android:hint="email"
android:inputType="textEmailAddress"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/name_fee"
app:layout_constraintStart_toStartOf="@+id/name_fee"
app:layout_constraintTop_toBottomOf="@+id/name_fee" />
<EditText
android:id="@+id/phonenumber_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:background="@drawable/text_field"
android:hint="phone_number"
android:inputType="phone"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/email_fee"
app:layout_constraintStart_toStartOf="@+id/email_fee"
app:layout_constraintTop_toBottomOf="@+id/email_fee" />
<EditText
android:id="@+id/address_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:background="@drawable/text_field"
android:hint="address"
android:inputType="text"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/phonenumber_fee"
app:layout_constraintStart_toStartOf="@+id/phonenumber_fee"
app:layout_constraintTop_toBottomOf="@+id/phonenumber_fee" />
<EditText
android:id="@+id/age_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:background="@drawable/text_field"
android:hint="age_of_the_child"
android:inputType="text"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/address_fee"
app:layout_constraintStart_toStartOf="@+id/address_fee"
app:layout_constraintTop_toBottomOf="@+id/address_fee" />
<CheckBox
android:id="@+id/trasportation_fee"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_marginTop="24dp"
app:layout_constraintStart_toStartOf="@+id/age_fee"
app:layout_constraintTop_toBottomOf="@+id/age_fee" />
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:padding="8dp"
android:text="is_transportation_required"
android:textColor="@color/blue_e72b3990"
android:textSize="16sp"
app:layout_constraintBottom_toBottomOf="@+id/trasportation_fee"
app:layout_constraintStart_toEndOf="@+id/trasportation_fee"
app:layout_constraintTop_toTopOf="@+id/trasportation_fee" />
<EditText
android:id="@+id/additional_info_fee"
android:layout_width="0dp"
android:layout_height="100dp"
android:layout_marginTop="24dp"
android:background="@drawable/text_field"
android:hint="additional_information"
android:inputType="text"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/age_fee"
app:layout_constraintStart_toStartOf="@+id/trasportation_fee"
app:layout_constraintTop_toBottomOf="@+id/textView2" />
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
</ScrollView>
<Button
android:id="@+id/requestfeestructure_btn_fee"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:background="@color/colorAccent"
android:padding="4dp"
app:layout_constraintBottom_toBottomOf="parent"
android:text="Request fee"
android:textColor="@color/blue_e72b3990"
android:textSize="14sp" />
</androidx.constraintlayout.widget.ConstraintLayout>
Actually, i have tried your layout. It contains lot of nesting which makes it more complex.
– ABr
Nov 26 '18 at 7:48
add a comment |
Button needs to be at the bottom right? So can you use ConstraintLayout instead of LinearLayout as the paretn layout and then set button at the bottom of parent using contraints
I have changed backgrounds,strings and some drawables to get a solution quickly as i tried this layout in my project.Please make necessary changes and try this layout
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#fff">
<ImageButton
android:id="@+id/back_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="4dp"
android:background="#fff"
android:src="@drawable/ic_athlete_indicator"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="0dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/back_btn"
android:layout_height="wrap_content">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<androidx.constraintlayout.widget.ConstraintLayout 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="wrap_content">
<TextView
android:id="@+id/feestructure"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:gravity="start"
android:text="request_fee_structure"
android:textColor="@color/colorPrimaryDark"
android:textSize="20sp"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/school_name_fee"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:gravity="start"
android:text="komal_day_care_service_and_pre_nursery"
android:textColor="@color/colorPrimaryDark"
android:textSize="16sp"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="@+id/feestructure"
app:layout_constraintTop_toBottomOf="@+id/feestructure" />
<EditText
android:id="@+id/name_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginEnd="24dp"
android:layout_marginTop="24dp"
android:background="@drawable/text_field"
android:elevation="40dp"
android:hint="name"
android:inputType="text"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@+id/school_name_fee"
app:layout_constraintTop_toBottomOf="@+id/school_name_fee" />
<EditText
android:id="@+id/email_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:background="@drawable/text_field"
android:hint="email"
android:inputType="textEmailAddress"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/name_fee"
app:layout_constraintStart_toStartOf="@+id/name_fee"
app:layout_constraintTop_toBottomOf="@+id/name_fee" />
<EditText
android:id="@+id/phonenumber_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:background="@drawable/text_field"
android:hint="phone_number"
android:inputType="phone"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/email_fee"
app:layout_constraintStart_toStartOf="@+id/email_fee"
app:layout_constraintTop_toBottomOf="@+id/email_fee" />
<EditText
android:id="@+id/address_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:background="@drawable/text_field"
android:hint="address"
android:inputType="text"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/phonenumber_fee"
app:layout_constraintStart_toStartOf="@+id/phonenumber_fee"
app:layout_constraintTop_toBottomOf="@+id/phonenumber_fee" />
<EditText
android:id="@+id/age_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:background="@drawable/text_field"
android:hint="age_of_the_child"
android:inputType="text"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/address_fee"
app:layout_constraintStart_toStartOf="@+id/address_fee"
app:layout_constraintTop_toBottomOf="@+id/address_fee" />
<CheckBox
android:id="@+id/trasportation_fee"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_marginTop="24dp"
app:layout_constraintStart_toStartOf="@+id/age_fee"
app:layout_constraintTop_toBottomOf="@+id/age_fee" />
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:padding="8dp"
android:text="is_transportation_required"
android:textColor="@color/blue_e72b3990"
android:textSize="16sp"
app:layout_constraintBottom_toBottomOf="@+id/trasportation_fee"
app:layout_constraintStart_toEndOf="@+id/trasportation_fee"
app:layout_constraintTop_toTopOf="@+id/trasportation_fee" />
<EditText
android:id="@+id/additional_info_fee"
android:layout_width="0dp"
android:layout_height="100dp"
android:layout_marginTop="24dp"
android:background="@drawable/text_field"
android:hint="additional_information"
android:inputType="text"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/age_fee"
app:layout_constraintStart_toStartOf="@+id/trasportation_fee"
app:layout_constraintTop_toBottomOf="@+id/textView2" />
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
</ScrollView>
<Button
android:id="@+id/requestfeestructure_btn_fee"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:background="@color/colorAccent"
android:padding="4dp"
app:layout_constraintBottom_toBottomOf="parent"
android:text="Request fee"
android:textColor="@color/blue_e72b3990"
android:textSize="14sp" />
</androidx.constraintlayout.widget.ConstraintLayout>
Button needs to be at the bottom right? So can you use ConstraintLayout instead of LinearLayout as the paretn layout and then set button at the bottom of parent using contraints
I have changed backgrounds,strings and some drawables to get a solution quickly as i tried this layout in my project.Please make necessary changes and try this layout
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#fff">
<ImageButton
android:id="@+id/back_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="4dp"
android:background="#fff"
android:src="@drawable/ic_athlete_indicator"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="0dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/back_btn"
android:layout_height="wrap_content">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<androidx.constraintlayout.widget.ConstraintLayout 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="wrap_content">
<TextView
android:id="@+id/feestructure"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:gravity="start"
android:text="request_fee_structure"
android:textColor="@color/colorPrimaryDark"
android:textSize="20sp"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/school_name_fee"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:gravity="start"
android:text="komal_day_care_service_and_pre_nursery"
android:textColor="@color/colorPrimaryDark"
android:textSize="16sp"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="@+id/feestructure"
app:layout_constraintTop_toBottomOf="@+id/feestructure" />
<EditText
android:id="@+id/name_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginEnd="24dp"
android:layout_marginTop="24dp"
android:background="@drawable/text_field"
android:elevation="40dp"
android:hint="name"
android:inputType="text"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@+id/school_name_fee"
app:layout_constraintTop_toBottomOf="@+id/school_name_fee" />
<EditText
android:id="@+id/email_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:background="@drawable/text_field"
android:hint="email"
android:inputType="textEmailAddress"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/name_fee"
app:layout_constraintStart_toStartOf="@+id/name_fee"
app:layout_constraintTop_toBottomOf="@+id/name_fee" />
<EditText
android:id="@+id/phonenumber_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:background="@drawable/text_field"
android:hint="phone_number"
android:inputType="phone"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/email_fee"
app:layout_constraintStart_toStartOf="@+id/email_fee"
app:layout_constraintTop_toBottomOf="@+id/email_fee" />
<EditText
android:id="@+id/address_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:background="@drawable/text_field"
android:hint="address"
android:inputType="text"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/phonenumber_fee"
app:layout_constraintStart_toStartOf="@+id/phonenumber_fee"
app:layout_constraintTop_toBottomOf="@+id/phonenumber_fee" />
<EditText
android:id="@+id/age_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:background="@drawable/text_field"
android:hint="age_of_the_child"
android:inputType="text"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/address_fee"
app:layout_constraintStart_toStartOf="@+id/address_fee"
app:layout_constraintTop_toBottomOf="@+id/address_fee" />
<CheckBox
android:id="@+id/trasportation_fee"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_marginTop="24dp"
app:layout_constraintStart_toStartOf="@+id/age_fee"
app:layout_constraintTop_toBottomOf="@+id/age_fee" />
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:padding="8dp"
android:text="is_transportation_required"
android:textColor="@color/blue_e72b3990"
android:textSize="16sp"
app:layout_constraintBottom_toBottomOf="@+id/trasportation_fee"
app:layout_constraintStart_toEndOf="@+id/trasportation_fee"
app:layout_constraintTop_toTopOf="@+id/trasportation_fee" />
<EditText
android:id="@+id/additional_info_fee"
android:layout_width="0dp"
android:layout_height="100dp"
android:layout_marginTop="24dp"
android:background="@drawable/text_field"
android:hint="additional_information"
android:inputType="text"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/age_fee"
app:layout_constraintStart_toStartOf="@+id/trasportation_fee"
app:layout_constraintTop_toBottomOf="@+id/textView2" />
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
</ScrollView>
<Button
android:id="@+id/requestfeestructure_btn_fee"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:background="@color/colorAccent"
android:padding="4dp"
app:layout_constraintBottom_toBottomOf="parent"
android:text="Request fee"
android:textColor="@color/blue_e72b3990"
android:textSize="14sp" />
</androidx.constraintlayout.widget.ConstraintLayout>
edited Nov 26 '18 at 7:54
answered Nov 26 '18 at 7:25
ABrABr
27027
27027
Actually, i have tried your layout. It contains lot of nesting which makes it more complex.
– ABr
Nov 26 '18 at 7:48
add a comment |
Actually, i have tried your layout. It contains lot of nesting which makes it more complex.
– ABr
Nov 26 '18 at 7:48
Actually, i have tried your layout. It contains lot of nesting which makes it more complex.
– ABr
Nov 26 '18 at 7:48
Actually, i have tried your layout. It contains lot of nesting which makes it more complex.
– ABr
Nov 26 '18 at 7:48
add a comment |
Try this, hope it will work.
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
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:background="#fff">
<ImageButton
android:id="@+id/back_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:background="#fff"
android:src="@drawable/ic_keyboard_backspace_black_24dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp"
android:fillViewport="true"
app:layout_constraintBottom_toTopOf="@+id/requestfeestructure_btn_fee"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/back_btn"
app:layout_constraintVertical_bias="0.0">
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/feestructure"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:gravity="start"
android:text="@string/request_fee_structure"
android:textColor="@color/colorPrimaryDark"
android:textSize="20sp"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent" />
<TextView
android:id="@+id/school_name_fee"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:gravity="start"
android:text="@string/komal_day_care_service_and_pre_nursery"
android:textColor="@color/colorPrimaryDark"
android:textSize="16sp"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="@+id/feestructure"
app:layout_constraintTop_toBottomOf="@+id/feestructure" />
<EditText
android:id="@+id/name_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:layout_marginEnd="24dp"
android:background="@drawable/ic_form_background"
android:elevation="40dp"
android:hint="@string/name"
android:inputType="text"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@+id/school_name_fee"
app:layout_constraintTop_toBottomOf="@+id/school_name_fee" />
<EditText
android:id="@+id/email_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:background="@drawable/ic_form_background"
android:hint="@string/email"
android:inputType="textEmailAddress"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/name_fee"
app:layout_constraintStart_toStartOf="@+id/name_fee"
app:layout_constraintTop_toBottomOf="@+id/name_fee" />
<EditText
android:id="@+id/phonenumber_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:background="@drawable/ic_form_background"
android:hint="@string/phone_number"
android:inputType="phone"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/email_fee"
app:layout_constraintStart_toStartOf="@+id/email_fee"
app:layout_constraintTop_toBottomOf="@+id/email_fee" />
<EditText
android:id="@+id/address_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:background="@drawable/ic_form_background"
android:hint="@string/address"
android:inputType="text"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/phonenumber_fee"
app:layout_constraintStart_toStartOf="@+id/phonenumber_fee"
app:layout_constraintTop_toBottomOf="@+id/phonenumber_fee" />
<EditText
android:id="@+id/age_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:background="@drawable/ic_form_background"
android:hint="@string/age_of_the_child"
android:inputType="text"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/address_fee"
app:layout_constraintStart_toStartOf="@+id/address_fee"
app:layout_constraintTop_toBottomOf="@+id/address_fee" />
<CheckBox
android:id="@+id/trasportation_fee"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_marginTop="24dp"
app:layout_constraintStart_toStartOf="@+id/age_fee"
app:layout_constraintTop_toBottomOf="@+id/age_fee" />
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:padding="8dp"
android:text="@string/is_transportation_required"
android:textColor="@color/grey"
android:textSize="16sp"
app:layout_constraintBottom_toBottomOf="@+id/trasportation_fee"
app:layout_constraintStart_toEndOf="@+id/trasportation_fee"
app:layout_constraintTop_toTopOf="@+id/trasportation_fee" />
<EditText
android:id="@+id/additional_info_fee"
android:layout_width="0dp"
android:layout_height="100dp"
android:layout_marginTop="24dp"
android:background="@drawable/ic_form_background"
android:hint="@string/additional_information"
android:inputType="text"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/age_fee"
app:layout_constraintStart_toStartOf="@+id/trasportation_fee"
app:layout_constraintTop_toBottomOf="@+id/textView2" />
</android.support.constraint.ConstraintLayout>
</android.support.v4.widget.NestedScrollView>
<Button
android:id="@+id/requestfeestructure_btn_fee"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginBottom="8dp"
android:background="@color/colorAccent"
android:padding="4dp"
android:text="@string/request_fee_structure"
android:textColor="@color/white"
android:textSize="14sp"
app:layout_constraintBottom_toBottomOf="parent" />
add a comment |
Try this, hope it will work.
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
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:background="#fff">
<ImageButton
android:id="@+id/back_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:background="#fff"
android:src="@drawable/ic_keyboard_backspace_black_24dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp"
android:fillViewport="true"
app:layout_constraintBottom_toTopOf="@+id/requestfeestructure_btn_fee"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/back_btn"
app:layout_constraintVertical_bias="0.0">
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/feestructure"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:gravity="start"
android:text="@string/request_fee_structure"
android:textColor="@color/colorPrimaryDark"
android:textSize="20sp"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent" />
<TextView
android:id="@+id/school_name_fee"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:gravity="start"
android:text="@string/komal_day_care_service_and_pre_nursery"
android:textColor="@color/colorPrimaryDark"
android:textSize="16sp"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="@+id/feestructure"
app:layout_constraintTop_toBottomOf="@+id/feestructure" />
<EditText
android:id="@+id/name_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:layout_marginEnd="24dp"
android:background="@drawable/ic_form_background"
android:elevation="40dp"
android:hint="@string/name"
android:inputType="text"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@+id/school_name_fee"
app:layout_constraintTop_toBottomOf="@+id/school_name_fee" />
<EditText
android:id="@+id/email_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:background="@drawable/ic_form_background"
android:hint="@string/email"
android:inputType="textEmailAddress"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/name_fee"
app:layout_constraintStart_toStartOf="@+id/name_fee"
app:layout_constraintTop_toBottomOf="@+id/name_fee" />
<EditText
android:id="@+id/phonenumber_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:background="@drawable/ic_form_background"
android:hint="@string/phone_number"
android:inputType="phone"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/email_fee"
app:layout_constraintStart_toStartOf="@+id/email_fee"
app:layout_constraintTop_toBottomOf="@+id/email_fee" />
<EditText
android:id="@+id/address_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:background="@drawable/ic_form_background"
android:hint="@string/address"
android:inputType="text"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/phonenumber_fee"
app:layout_constraintStart_toStartOf="@+id/phonenumber_fee"
app:layout_constraintTop_toBottomOf="@+id/phonenumber_fee" />
<EditText
android:id="@+id/age_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:background="@drawable/ic_form_background"
android:hint="@string/age_of_the_child"
android:inputType="text"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/address_fee"
app:layout_constraintStart_toStartOf="@+id/address_fee"
app:layout_constraintTop_toBottomOf="@+id/address_fee" />
<CheckBox
android:id="@+id/trasportation_fee"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_marginTop="24dp"
app:layout_constraintStart_toStartOf="@+id/age_fee"
app:layout_constraintTop_toBottomOf="@+id/age_fee" />
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:padding="8dp"
android:text="@string/is_transportation_required"
android:textColor="@color/grey"
android:textSize="16sp"
app:layout_constraintBottom_toBottomOf="@+id/trasportation_fee"
app:layout_constraintStart_toEndOf="@+id/trasportation_fee"
app:layout_constraintTop_toTopOf="@+id/trasportation_fee" />
<EditText
android:id="@+id/additional_info_fee"
android:layout_width="0dp"
android:layout_height="100dp"
android:layout_marginTop="24dp"
android:background="@drawable/ic_form_background"
android:hint="@string/additional_information"
android:inputType="text"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/age_fee"
app:layout_constraintStart_toStartOf="@+id/trasportation_fee"
app:layout_constraintTop_toBottomOf="@+id/textView2" />
</android.support.constraint.ConstraintLayout>
</android.support.v4.widget.NestedScrollView>
<Button
android:id="@+id/requestfeestructure_btn_fee"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginBottom="8dp"
android:background="@color/colorAccent"
android:padding="4dp"
android:text="@string/request_fee_structure"
android:textColor="@color/white"
android:textSize="14sp"
app:layout_constraintBottom_toBottomOf="parent" />
add a comment |
Try this, hope it will work.
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
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:background="#fff">
<ImageButton
android:id="@+id/back_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:background="#fff"
android:src="@drawable/ic_keyboard_backspace_black_24dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp"
android:fillViewport="true"
app:layout_constraintBottom_toTopOf="@+id/requestfeestructure_btn_fee"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/back_btn"
app:layout_constraintVertical_bias="0.0">
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/feestructure"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:gravity="start"
android:text="@string/request_fee_structure"
android:textColor="@color/colorPrimaryDark"
android:textSize="20sp"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent" />
<TextView
android:id="@+id/school_name_fee"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:gravity="start"
android:text="@string/komal_day_care_service_and_pre_nursery"
android:textColor="@color/colorPrimaryDark"
android:textSize="16sp"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="@+id/feestructure"
app:layout_constraintTop_toBottomOf="@+id/feestructure" />
<EditText
android:id="@+id/name_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:layout_marginEnd="24dp"
android:background="@drawable/ic_form_background"
android:elevation="40dp"
android:hint="@string/name"
android:inputType="text"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@+id/school_name_fee"
app:layout_constraintTop_toBottomOf="@+id/school_name_fee" />
<EditText
android:id="@+id/email_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:background="@drawable/ic_form_background"
android:hint="@string/email"
android:inputType="textEmailAddress"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/name_fee"
app:layout_constraintStart_toStartOf="@+id/name_fee"
app:layout_constraintTop_toBottomOf="@+id/name_fee" />
<EditText
android:id="@+id/phonenumber_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:background="@drawable/ic_form_background"
android:hint="@string/phone_number"
android:inputType="phone"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/email_fee"
app:layout_constraintStart_toStartOf="@+id/email_fee"
app:layout_constraintTop_toBottomOf="@+id/email_fee" />
<EditText
android:id="@+id/address_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:background="@drawable/ic_form_background"
android:hint="@string/address"
android:inputType="text"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/phonenumber_fee"
app:layout_constraintStart_toStartOf="@+id/phonenumber_fee"
app:layout_constraintTop_toBottomOf="@+id/phonenumber_fee" />
<EditText
android:id="@+id/age_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:background="@drawable/ic_form_background"
android:hint="@string/age_of_the_child"
android:inputType="text"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/address_fee"
app:layout_constraintStart_toStartOf="@+id/address_fee"
app:layout_constraintTop_toBottomOf="@+id/address_fee" />
<CheckBox
android:id="@+id/trasportation_fee"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_marginTop="24dp"
app:layout_constraintStart_toStartOf="@+id/age_fee"
app:layout_constraintTop_toBottomOf="@+id/age_fee" />
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:padding="8dp"
android:text="@string/is_transportation_required"
android:textColor="@color/grey"
android:textSize="16sp"
app:layout_constraintBottom_toBottomOf="@+id/trasportation_fee"
app:layout_constraintStart_toEndOf="@+id/trasportation_fee"
app:layout_constraintTop_toTopOf="@+id/trasportation_fee" />
<EditText
android:id="@+id/additional_info_fee"
android:layout_width="0dp"
android:layout_height="100dp"
android:layout_marginTop="24dp"
android:background="@drawable/ic_form_background"
android:hint="@string/additional_information"
android:inputType="text"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/age_fee"
app:layout_constraintStart_toStartOf="@+id/trasportation_fee"
app:layout_constraintTop_toBottomOf="@+id/textView2" />
</android.support.constraint.ConstraintLayout>
</android.support.v4.widget.NestedScrollView>
<Button
android:id="@+id/requestfeestructure_btn_fee"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginBottom="8dp"
android:background="@color/colorAccent"
android:padding="4dp"
android:text="@string/request_fee_structure"
android:textColor="@color/white"
android:textSize="14sp"
app:layout_constraintBottom_toBottomOf="parent" />
Try this, hope it will work.
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
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:background="#fff">
<ImageButton
android:id="@+id/back_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:background="#fff"
android:src="@drawable/ic_keyboard_backspace_black_24dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp"
android:fillViewport="true"
app:layout_constraintBottom_toTopOf="@+id/requestfeestructure_btn_fee"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/back_btn"
app:layout_constraintVertical_bias="0.0">
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/feestructure"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:gravity="start"
android:text="@string/request_fee_structure"
android:textColor="@color/colorPrimaryDark"
android:textSize="20sp"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent" />
<TextView
android:id="@+id/school_name_fee"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:gravity="start"
android:text="@string/komal_day_care_service_and_pre_nursery"
android:textColor="@color/colorPrimaryDark"
android:textSize="16sp"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="@+id/feestructure"
app:layout_constraintTop_toBottomOf="@+id/feestructure" />
<EditText
android:id="@+id/name_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:layout_marginEnd="24dp"
android:background="@drawable/ic_form_background"
android:elevation="40dp"
android:hint="@string/name"
android:inputType="text"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@+id/school_name_fee"
app:layout_constraintTop_toBottomOf="@+id/school_name_fee" />
<EditText
android:id="@+id/email_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:background="@drawable/ic_form_background"
android:hint="@string/email"
android:inputType="textEmailAddress"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/name_fee"
app:layout_constraintStart_toStartOf="@+id/name_fee"
app:layout_constraintTop_toBottomOf="@+id/name_fee" />
<EditText
android:id="@+id/phonenumber_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:background="@drawable/ic_form_background"
android:hint="@string/phone_number"
android:inputType="phone"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/email_fee"
app:layout_constraintStart_toStartOf="@+id/email_fee"
app:layout_constraintTop_toBottomOf="@+id/email_fee" />
<EditText
android:id="@+id/address_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:background="@drawable/ic_form_background"
android:hint="@string/address"
android:inputType="text"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/phonenumber_fee"
app:layout_constraintStart_toStartOf="@+id/phonenumber_fee"
app:layout_constraintTop_toBottomOf="@+id/phonenumber_fee" />
<EditText
android:id="@+id/age_fee"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="24dp"
android:background="@drawable/ic_form_background"
android:hint="@string/age_of_the_child"
android:inputType="text"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/address_fee"
app:layout_constraintStart_toStartOf="@+id/address_fee"
app:layout_constraintTop_toBottomOf="@+id/address_fee" />
<CheckBox
android:id="@+id/trasportation_fee"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_marginTop="24dp"
app:layout_constraintStart_toStartOf="@+id/age_fee"
app:layout_constraintTop_toBottomOf="@+id/age_fee" />
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:padding="8dp"
android:text="@string/is_transportation_required"
android:textColor="@color/grey"
android:textSize="16sp"
app:layout_constraintBottom_toBottomOf="@+id/trasportation_fee"
app:layout_constraintStart_toEndOf="@+id/trasportation_fee"
app:layout_constraintTop_toTopOf="@+id/trasportation_fee" />
<EditText
android:id="@+id/additional_info_fee"
android:layout_width="0dp"
android:layout_height="100dp"
android:layout_marginTop="24dp"
android:background="@drawable/ic_form_background"
android:hint="@string/additional_information"
android:inputType="text"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@+id/age_fee"
app:layout_constraintStart_toStartOf="@+id/trasportation_fee"
app:layout_constraintTop_toBottomOf="@+id/textView2" />
</android.support.constraint.ConstraintLayout>
</android.support.v4.widget.NestedScrollView>
<Button
android:id="@+id/requestfeestructure_btn_fee"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginBottom="8dp"
android:background="@color/colorAccent"
android:padding="4dp"
android:text="@string/request_fee_structure"
android:textColor="@color/white"
android:textSize="14sp"
app:layout_constraintBottom_toBottomOf="parent" />
edited Nov 26 '18 at 7:56
answered Nov 26 '18 at 7:46
Ankit SinghAnkit Singh
113
113
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53476009%2fandroid-layout-using-constraint-layout-scrollview-linear-layout%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
use fillViewport=true in scrollview
– Karan Mer
Nov 26 '18 at 6:55