title: android scrollable activity layout
body: <p>I am trying to make my activity screen where there is a form to be filled scrollable but unfortunately, when I tried it crashed the app. I have the following xml for that activity:</p>
  
  <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:background="@color/background"
      android:paddingBottom="16dp"
      android:paddingLeft="16dp"
      android:paddingRight="16dp"
      android:paddingTop="16dp"
      android:textDirection="anyRtl"
      tools:context=".AddDiscountActivity" &gt;
  
      &lt;TextView
          android:id="@+id/textView4"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_alignRight="@+id/textView3"
          android:layout_below="@+id/textView3"
          android:layout_marginTop="19dp"
          android:text="@string/discountLocationLabel"
          android:textAppearance="?android:attr/textAppearanceMedium"
          android:textColor="@color/white"
          android:textStyle="bold" /&gt;
  
      &lt;EditText
          android:id="@+id/shopLocation"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_alignBaseline="@+id/textView4"
          android:layout_alignBottom="@+id/textView4"
          android:layout_alignRight="@+id/shopCity"
          android:ems="10"
          android:inputType="text" /&gt;
  
      &lt;TextView
          android:id="@+id/textView6"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_alignRight="@+id/textView5"
          android:layout_below="@+id/shopDiscount"
          android:layout_marginTop="21dp"
          android:text="@string/discountDurationLabel"
          android:textAppearance="?android:attr/textAppearanceMedium"
          android:textColor="@color/white"
          android:textStyle="bold" /&gt;
  
      &lt;EditText
          android:id="@+id/shopDiscountDuration"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_alignBottom="@+id/textView6"
          android:layout_alignLeft="@+id/shopDiscount"
          android:ems="10"
          android:inputType="text" /&gt;
  
      &lt;TextView
          android:id="@+id/textView5"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_alignBottom="@+id/shopDiscount"
          android:layout_alignParentRight="true"
          android:text="@string/discountRateLabel"
          android:textAppearance="?android:attr/textAppearanceMedium"
          android:textColor="@color/white"
          android:textStyle="bold" /&gt;
  
      &lt;Button
          android:id="@+id/button1"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_below="@+id/textView6"
          android:layout_centerHorizontal="true"
          android:layout_marginTop="18dp"
          android:background="@drawable/roundbutton"
          android:text="@string/discountPublishButtonLabel"
          android:textColor="@color/white"
          android:onClick="SubmitData"
          android:width="250dp" /&gt;
  
      &lt;EditText
          android:id="@+id/shopCity"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_above="@+id/textView4"
          android:layout_alignRight="@+id/shopName"
          android:ems="10"
          android:inputType="text" &gt;
  
  
      &lt;/EditText&gt;
  
      &lt;EditText
          android:id="@+id/shopDiscount"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_alignLeft="@+id/shopLocation"
          android:layout_below="@+id/shopLocation"
          android:layout_marginTop="14dp"
          android:ems="10"
          android:inputType="number" /&gt;
  
      &lt;EditText
          android:id="@+id/shopName"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_alignBaseline="@+id/textView2"
          android:layout_alignBottom="@+id/textView2"
          android:layout_alignParentLeft="true"
          android:layout_marginLeft="14dp"
          android:ems="10"
          android:inputType="text"&gt; 
           &lt;requestFocus /&gt;
      &lt;/EditText&gt;
  
      &lt;TextView
          android:id="@+id/textView1"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_alignBottom="@+id/categoriesSpinner"
          android:layout_alignRight="@+id/textView2"
          android:text="@string/discountCategoryLabel"
          android:textAppearance="?android:attr/textAppearanceMedium"
          android:textColor="@color/white"
          android:textStyle="bold" /&gt;
  
      &lt;Spinner
          android:id="@+id/categoriesSpinner"
          android:layout_width="160dp"
          android:layout_height="wrap_content"
          android:layout_above="@+id/shopName"
          android:layout_alignLeft="@+id/button1"
          android:layout_marginBottom="16dp" /&gt;
  
      &lt;TextView
          android:id="@+id/textView3"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_alignParentTop="true"
          android:layout_alignRight="@+id/textView2"
          android:layout_marginTop="206dp"
          android:text="@string/discountCityLabel"
          android:textAppearance="?android:attr/textAppearanceMedium"
          android:textColor="@color/white"
          android:textStyle="bold" /&gt;
  
      &lt;TextView
          android:id="@+id/textView2"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_above="@+id/shopCity"
          android:layout_alignLeft="@+id/textView5"
          android:layout_marginBottom="18dp"
          android:text="@string/discountShopLabel"
          android:textAppearance="?android:attr/textAppearanceMedium"
          android:textColor="@color/white"
          android:textStyle="bold" /&gt;
  
      &lt;TextView
          android:id="@+id/textView7"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_alignParentTop="true"
          android:layout_alignRight="@+id/textView1"
          android:layout_marginTop="14dp"
          android:gravity="right"
          android:text="@string/addDiscountMsg"
          android:textAlignment="viewEnd"
          android:textAppearance="?android:attr/textAppearanceMedium"
          android:textColor="@color/white"
          android:textDirection="anyRtl" /&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>And when I tried to add the following after defining RelativeLayout and before closing RelativeLayout, it broke the app immediately when I run it. </p>
  
  <pre><code>    &lt;ScrollView
              android:layout_width="fill_parent"
              android:layout_height="fill_parent"
               &gt;
  
              ...........
  &lt;/ScrollView&gt;
  </code></pre>
  
  <p>How can I make it scrollable? </p>