title: Applying Scroll View to a Framelayout in Android
body: <p>Here is a layout for sign up and login. How do I make only the sign up form scrollable especially for small screens? I tried adding <code>ScrollView</code> but it doesn't seem to work. I'm using <code>TabLayout</code> to change between fragments. The <code>FrameLayout</code> with id "container_frame" is inflated with the fragment layout. Here is my XML layout </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
          &lt;FrameLayout
              android:id="@+id/frameLayout_top"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              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"
              tools:context=".RegisterActivity"&gt;
  
              &lt;ImageView
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:background="@drawable/mother_daughter" /&gt;
  
              &lt;android.support.constraint.ConstraintLayout
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"&gt;
  
                  &lt;TextView
                      android:id="@+id/txtview_please_sign_up"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:layout_marginStart="16dp"
                      android:layout_marginTop="32dp"
                      android:text="@string/PLEASE_SIGN_UP"
                      android:textColor="@color/white"
                      android:textSize="20sp"
                      android:textStyle="bold"
                      app:layout_constraintStart_toStartOf="parent"
                      app:layout_constraintTop_toTopOf="parent" /&gt;
  
                  &lt;TextView
                      android:id="@+id/textView5"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:layout_marginTop="8dp"
                      android:text="@string/to_add_your_review"
                      android:textColor="@color/white"
                      android:textSize="18sp"
                      android:textStyle="bold"
                      app:layout_constraintStart_toStartOf="@+id/txtview_please_sign_up"
                      app:layout_constraintTop_toBottomOf="@+id/txtview_please_sign_up" /&gt;
  
                  &lt;Button
                      android:id="@+id/facebook"
                      android:layout_width="0dp"
                      android:layout_height="wrap_content"
                      android:layout_marginStart="8dp"
                      android:layout_marginTop="32dp"
                      android:layout_marginEnd="8dp"
                      android:background="#3b5998"
                      android:minWidth="64dp"
                      android:paddingStart="16dp"
                      android:paddingEnd="16dp"
                      android:text="@string/log_in_with_facebook"
                      android:textColor="@color/white"
                      android:textSize="12sp"
                      android:theme="@style/Theme.MaterialComponents"
                      app:layout_constraintEnd_toStartOf="@+id/Google"
                      app:layout_constraintStart_toStartOf="parent"
                      app:layout_constraintTop_toBottomOf="@+id/textView5" /&gt;
  
                  &lt;Button
                      android:id="@+id/Google"
                      android:layout_width="0dp"
                      android:layout_height="wrap_content"
                      android:layout_marginEnd="8dp"
                      android:background="#D44638"
                      android:minWidth="64dp"
                      android:paddingStart="16dp"
                      android:paddingEnd="16dp"
                      android:text="@string/log_in_with_google"
                      android:textColor="@color/white"
                      android:textSize="12sp"
                      android:theme="@style/Theme.MaterialComponents"
                      app:layout_constraintBottom_toBottomOf="@+id/facebook"
                      app:layout_constraintEnd_toEndOf="parent"
                      app:layout_constraintStart_toEndOf="@+id/facebook"
                      app:layout_constraintTop_toTopOf="@+id/facebook"
                      app:layout_constraintVertical_bias="0.0" /&gt;
  
                  &lt;View
                      android:id="@+id/divider1"
                      android:layout_width="0dp"
                      android:layout_height="2dp"
                      android:layout_marginStart="8dp"
                      android:background="@color/white"
                      app:layout_constraintBottom_toBottomOf="@+id/textView6"
                      app:layout_constraintEnd_toStartOf="@+id/textView6"
                      app:layout_constraintStart_toStartOf="@+id/facebook"
                      app:layout_constraintTop_toTopOf="@+id/textView6" /&gt;
  
                  &lt;View
                      android:id="@+id/divider2"
                      android:layout_width="0dp"
                      android:layout_height="2dp"
                      android:layout_marginEnd="8dp"
                      android:background="@color/white"
                      app:layout_constraintBottom_toBottomOf="@+id/textView6"
                      app:layout_constraintEnd_toEndOf="@+id/Google"
                      app:layout_constraintStart_toEndOf="@+id/textView6"
                      app:layout_constraintTop_toTopOf="@+id/textView6" /&gt;
  
                  &lt;TextView
                      android:id="@+id/textView6"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:layout_marginStart="24dp"
                      android:layout_marginTop="16dp"
                      android:layout_marginEnd="24dp"
                      android:text="@string/or"
                      android:textColor="@color/white"
                      android:textSize="16sp"
                      android:textStyle="bold"
                      app:layout_constraintEnd_toStartOf="@+id/divider2"
                      app:layout_constraintStart_toEndOf="@+id/divider1"
                      app:layout_constraintTop_toBottomOf="@+id/Google" /&gt;
  
                  &lt;LinearLayout
                      android:id="@+id/frameLayout_bottom"
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:layout_marginStart="24dp"
                      android:layout_marginTop="8dp"
                      android:layout_marginEnd="24dp"
                      android:layout_marginBottom="16dp"
                      app:layout_constraintEnd_toEndOf="parent"
                      app:layout_constraintStart_toStartOf="parent"
                      app:layout_constraintTop_toBottomOf="@+id/textView6"
                      android:orientation="vertical"&gt;
  
                      &lt;android.support.design.widget.AppBarLayout
                          android:id="@+id/appbar"
                          android:layout_width="match_parent"
                          android:layout_height="56dp"
                          android:theme="@style/CustomTabLayout"
                          app:layout_behavior="@string/appbar_scrolling_view_behavior"&gt;
  
                          &lt;android.support.design.widget.TabLayout
                              android:id="@+id/tabs"
                              android:layout_width="match_parent"
                              android:layout_height="56dp"&gt;
  
                              &lt;android.support.design.widget.TabItem
                                  android:id="@+id/tabItem"
                                  android:layout_width="wrap_content"
                                  android:layout_height="wrap_content"
                                  android:text="@string/login" /&gt;
  
                              &lt;android.support.design.widget.TabItem
                                  android:id="@+id/tabItem2"
                                  android:layout_width="wrap_content"
                                  android:layout_height="wrap_content"
                                  android:text="@string/sign_up" /&gt;
                          &lt;/android.support.design.widget.TabLayout&gt;
                      &lt;/android.support.design.widget.AppBarLayout&gt;
  
                      &lt;!--&lt;android.support.v4.view.ViewPager
                          android:id="@+id/container"
                          android:layout_width="match_parent"
                          android:layout_height="wrap_content"
                          app:layout_constraintBottom_toTopOf="parent"
                          app:layout_constraintTop_toBottomOf="@id/appbar" /&gt;--&gt;
  
                      &lt;ScrollView
                          android:layout_width="match_parent"
                          android:layout_height="match_parent"
                          android:fillViewport="true"&gt;
                      &lt;FrameLayout
                          android:id="@+id/container_frame"
                          android:layout_width="match_parent"
                          android:layout_height="wrap_content"
                        app:layout_constraintTop_toBottomOf="@+id/appbar"
                          app:layout_constraintBottom_toTopOf="parent"
                          /&gt;
                      &lt;/ScrollView&gt;
  
  
       &lt;/LinearLayout&gt;
  
              &lt;/android.support.constraint.ConstraintLayout&gt;
  
          &lt;/FrameLayout&gt;
  </code></pre>
  
  <p>The screenshots are here <img src="https://i.stack.imgur.com/OoZIK.png" alt="larger display device"> <img src="https://i.stack.imgur.com/escY4.png" alt="smaller screen device"></p>
  
  <p>Here is my fragment layout which is inflated to the <code>FrameLayout</code> of above layout.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;android.support.v7.widget.CardView
      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"
      tools:context=".SignUpFragment"
      app:cardUseCompatPadding="true"
      app:cardElevation="4dp"
      app:cardCornerRadius="3dp"
      android:layout_marginBottom="16dp"
      &gt;
      &lt;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="match_parent"
      android:layout_marginBottom="16dp"&gt;
  
      &lt;TextView
          android:id="@+id/textViewname"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_marginStart="16dp"
          android:layout_marginTop="8dp"
          android:text="@string/name1"
          android:textColor="@color/grey"
          android:textSize="14sp"
          app:layout_constraintStart_toStartOf="parent"
          app:layout_constraintTop_toTopOf="parent" /&gt;
  
      &lt;EditText
          android:id="@+id/signup_name"
          android:layout_width="match_parent"
          android:layout_height="56dp"
          android:layout_marginStart="8dp"
          android:layout_marginTop="8dp"
          android:layout_marginEnd="32dp"
          android:hint="@string/enter_your_name"
          android:inputType="text"
          android:textSize="14sp"
          app:layout_constraintEnd_toEndOf="parent"
          app:layout_constraintStart_toStartOf="@+id/textViewname"
          app:layout_constraintTop_toBottomOf="@+id/textViewname" /&gt;
  
      &lt;TextView
          android:id="@+id/textViewemail"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_marginTop="8dp"
          android:text="@string/email2"
          android:textColor="@color/grey"
          android:textSize="14sp"
          app:layout_constraintStart_toStartOf="@+id/textViewname"
          app:layout_constraintTop_toBottomOf="@+id/signup_name" /&gt;
  
      &lt;EditText
          android:id="@+id/signup_email"
          android:layout_width="0dp"
          android:layout_height="56dp"
          android:layout_marginTop="8dp"
          android:inputType="textEmailAddress"
          android:hint="@string/enter_your_email"
          android:textSize="14sp"
          app:layout_constraintEnd_toEndOf="@+id/signup_name"
          app:layout_constraintStart_toStartOf="@+id/signup_name"
          app:layout_constraintTop_toBottomOf="@+id/textViewemail" /&gt;
  
      &lt;TextView
          android:id="@+id/textViewpassword"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_marginTop="8dp"
          android:text="@string/password"
          android:textColor="@color/grey"
          android:textSize="14sp"
          app:layout_constraintStart_toStartOf="@+id/textViewemail"
          app:layout_constraintTop_toBottomOf="@+id/signup_email" /&gt;
  
      &lt;EditText
          android:id="@+id/signup_password"
          android:layout_width="0dp"
          android:layout_height="56dp"
          android:layout_marginTop="8dp"
          android:inputType="textPassword"
          android:textSize="14sp"
          app:layout_constraintEnd_toEndOf="@+id/signup_email"
          app:layout_constraintStart_toStartOf="@+id/signup_email"
          app:layout_constraintTop_toBottomOf="@+id/textViewpassword" /&gt;
  
      &lt;TextView
          android:id="@+id/textViewconfirmpassword"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_marginTop="8dp"
          android:text="@string/confirm_password"
          android:textColor="@color/grey"
          android:textSize="14sp"
          app:layout_constraintStart_toStartOf="@+id/textViewpassword"
          app:layout_constraintTop_toBottomOf="@+id/signup_password" /&gt;
      &lt;EditText
          android:id="@+id/signup_confirmpassword"
          android:layout_width="0dp"
          android:layout_height="56dp"
          android:layout_marginTop="8dp"
          android:inputType="textPassword"
          android:textSize="14sp"
          app:layout_constraintEnd_toEndOf="@+id/signup_password"
          app:layout_constraintStart_toStartOf="@+id/signup_password"
          app:layout_constraintTop_toBottomOf="@+id/textViewconfirmpassword" /&gt;
  
      &lt;Button
          android:layout_width="0dp"
          android:layout_height="36dp"
          android:layout_marginStart="8dp"
          android:layout_marginTop="16dp"
          android:layout_marginEnd="8dp"
          android:background="@color/colorPrimaryDark"
  
          android:text="@string/sign_up"
          android:textColor="@color/white"
          android:textSize="16sp"
          app:layout_constraintEnd_toEndOf="@+id/signup_confirmpassword"
       app:layout_constraintStart_toStartOf="@+id/signup_confirmpassword"
        app:layout_constraintTop_toBottomOf="@+id/signup_confirmpassword" /&gt;
  
  
  &lt;/android.support.constraint.ConstraintLayout&gt;
  &lt;/android.support.v7.widget.CardView&gt;
  </code></pre>