ScrollView
If your Linear Layout with 'vertical' orientation has widgets which go beyond the vertical screen size, then you can enclose the LinearLayout inside a 'ScrollView' layout, which enables vertical scrolling. You would add the ScrollView as shown below in the xml file:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView 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"
tools:context=".MainActivity">
<LinearLayout
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="match_parent">
<TextView
android:id="@+id/question"
android:layout_width="match_parent"
android:layout_height="200dp"
android:text="TextView" />
<Button
android:id="@+id/ans1"
android:layout_width="match_parent"
android:layout_height="300dp"
android:onClick="ans1Clicked"
android:text="" />
</LinearLayout>
</ScrollView>
Note that the ScrollView can contain only one child and that child in this case is the LinearLayout. LinearLayout itself can have many children, as shown in the example.
For horizontal scrolling, you would use HorizontalScrollView.
Reference:https://developer.android.com/reference/android/widget/ScrollView