I am new to Android. I am creating a form to add users. As the form fields are many, I need to scroll down. I read that the ScrollView takes only one child view. I have wrapped my view inside a Linear Layout which is the direct child of the ScrollView.
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorWhite"
android:animateLayoutChanges="true"
android:scrollbars="none">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<EditText... />
<EditText.../>
<EditText... />
<EditText.../>
<LinearLayout... >
<LinearLayout... >
<LinearLayout... >
<TextView... />
</LinearLayout>
<ScrollView/>
Use below code
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:fillViewport="true"
android:layout_marginTop="30dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/scrollView">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Button 1" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Button 2" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Button 3" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Button 4" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Button 5" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Button 6" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Button 7" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Button 8" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Button 9" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Button 10" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Button 11" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Button 12" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Button 13" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Button 14" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Button 15" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Button 16" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Button 17" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Button 18" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Button 19" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Button 20" />
</LinearLayout>
</ScrollView>