How can I set ScrollView as the parent of an RelativeLayout?

android, android-layout

Solution

Add a ScrollView as the root of your screen. ScrollView should have a single child layout that contains all the children..

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >

    <RelativeLayout 
    android:layout_width="match_parent"
    android:layout_height="match_parent">

        <!-- All your views -->

     </RelativeLayout>
</ScrollView>

Problem

I am new to the android app development now i am designing an app,in that i have an activity which has two parallel edit text fields like shown in the image (contains 15 sets of edit text fields). I used relative layout. I want to add a vertical scroll view because some text fields go out from the screen. I studied few tutorials and all of them use linear layouts to add scroll view. Here is my layout.xml file ``` <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <EditText android:id="@+id/editText5" android:layout_width="85dp" android:layout_height="wrap_content" android:layout_marginLeft="100dp" android:layout_marginTop="5dp" /> <EditText android:id="@+id/editText1" android:layout_width="85dp" android:layout_height="wrap_content" android:layout_marginLeft="200dp" android:layout_marginTop="5dp" /> <EditText android:id="@+id/EditText01" android:layout_width="85dp" android:layout_height="wrap_content" android:layout_alignLeft="@+id/editText5" android:layout_below="@+id/editText5" android:layout_marginTop="17dp" /> <EditText android:id="@+id/EditText02" android:layout_width="85dp" android:layout_height="wrap_content" android:layout_alignBaseline="@+id/EditText01" android:layout_alignBottom="@+id/EditText01" android:layout_alignLeft="@+id/editText1" /> </RelativeLayout> ``` Here how can I add scroll view without changing two parallel edit text fields. Please guide me. Thank you!

Original source