'Scroll View doesn't work in Frame Layout - Android XML

I'm using fragments to recreate a design, so basically my design consists of four buttons which are present in a Relative Layout and the remaining empty space of the activity is used as a fragment.

So everything works fine until the content in the fragment goes beyond the screen and it is not visible anymore. So I want to implement a ScrollView, so the user can scroll to see all the content, but unfortunately that doesn't work. I have been looking for solution all day but nothing helped.

Here is the image for reference.

ScrollView doesn't work in framelayout

Every suggestion is appreciated! Thank you.

Here is the code;

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout 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"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    tools:context=".Fragment_1">

   <androidx.constraintlayout.widget.ConstraintLayout
       android:layout_width="match_parent"
       android:layout_height="match_parent">

        <TextView
            android:id="@+id/text_1_frame_1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginStart="10dp"
            app:layout_constraintTop_toTopOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            android:layout_marginEnd="10dp"
            android:fontFamily="@font/alata"
            android:textStyle="bold"
            android:text="@string/fragment_1_text_1"
            android:textColor="@color/Deloitte"
            android:textSize="32sp" />

       <ScrollView
           android:layout_width="wrap_content"
           android:layout_height="wrap_content"
           app:layout_constraintTop_toBottomOf="@id/text_1_frame_1"
           app:layout_constraintStart_toStartOf="parent"
           app:layout_constraintEnd_toEndOf="parent">

                <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:orientation="vertical">

        <RelativeLayout
            android:id="@+id/rl1_frame_1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="25dp"
            android:layout_marginEnd="10dp"
            android:layout_marginStart="10dp"
            android:background="@drawable/frame_design">

            <TextView
                android:id="@+id/education_1"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:fontFamily="@font/open_sans"
                android:padding="10dp"
                android:text="@string/bachelors_in_engineering_cse"
                android:textColor="@color/white"
                android:textSize="18sp"
                android:textStyle="bold" />

            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:paddingStart="10dp"
                android:paddingEnd="10dp"
                android:fontFamily="@font/open_sans"
                android:layout_below="@id/education_1"
                android:text="@string/neil_gogte_institute_of_technology_n_2020_2023"
                android:textColor="@color/white"
                android:textStyle="italic"
                android:textSize="16sp"
                android:paddingBottom="10dp"/>

        </RelativeLayout>

        <RelativeLayout
            android:id="@+id/rl1_frame_2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@id/rl1_frame_1"
            android:layout_marginTop="10dp"
            android:layout_marginEnd="10dp"
            android:layout_marginStart="10dp"
            android:background="@drawable/frame_design">

            <TextView
                android:id="@+id/education_2"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:fontFamily="@font/open_sans"
                android:padding="10dp"
                android:text="@string/diploma_in_computer_science"
                android:textColor="@color/white"
                android:textSize="18sp"
                android:textStyle="bold" />

            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:paddingStart="10dp"
                android:paddingEnd="10dp"
                android:fontFamily="@font/open_sans"
                android:layout_below="@id/education_2"
                android:text="@string/government_institute_of_electronics_n_2016_2019"
                android:textColor="@color/white"
                android:textStyle="italic"
                android:textSize="16sp"
                android:paddingBottom="10dp"/>

        </RelativeLayout>

        <RelativeLayout
            android:id="@+id/rl1_frame_3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@id/rl1_frame_2"
            android:layout_marginTop="10dp"
            android:layout_marginEnd="10dp"
            android:layout_marginStart="10dp"
            android:background="@drawable/frame_design">

            <TextView
                android:id="@+id/education_3"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:fontFamily="@font/open_sans"
                android:padding="10dp"
                android:text="@string/ts_ssc"
                android:textColor="@color/white"
                android:textSize="18sp"
                android:textStyle="bold" />

            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:paddingStart="10dp"
                android:paddingEnd="10dp"
                android:fontFamily="@font/open_sans"
                android:layout_below="@id/education_3"
                android:text="@string/bhashyam_high_school_n_2015_2016"
                android:textColor="@color/white"
                android:textStyle="italic"
                android:textSize="16sp"
                android:paddingBottom="10dp"/>

        </RelativeLayout>
    <RelativeLayout
        android:id="@+id/certification_rl"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="25dp"
        android:layout_marginEnd="10dp"
        android:layout_marginStart="10dp"
        android:layout_below="@id/rl1_frame_3"
        android:background="@drawable/frame_design">

        <ImageView
            android:id="@+id/certification"
            android:layout_width="match_parent"
            android:layout_marginTop="10dp"
            android:layout_height="wrap_content"
            android:contentDescription="@string/certificate_icon"
            android:layout_centerHorizontal="true"
            android:src="@drawable/certification" />

        <TextView
            android:id="@+id/certification_1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@id/certification"
            android:layout_centerHorizontal="true"
            android:fontFamily="@font/open_sans"
            android:padding="10dp"
            android:text="@string/android_basics_nanodegree_by_google"
            android:textColor="@color/white"
            android:textSize="18sp"
            android:textStyle="bold" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@id/certification_1"
            android:fontFamily="@font/open_sans"
            android:paddingBottom="10dp"
            android:layout_centerHorizontal="true"
            android:text="Certified on July,2019 "
            android:textColor="@color/white"
            android:textSize="16sp"
            android:textStyle="italic"
            tools:ignore="HardcodedText" />
    </RelativeLayout>

                    <RelativeLayout
                        android:id="@+id/certification_rl_2"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="25dp"
                        android:layout_marginEnd="10dp"
                        android:layout_marginStart="10dp"
                        android:layout_below="@id/rl1_frame_3"
                        android:background="@drawable/frame_design">

                        <ImageView
                            android:id="@+id/certification_img"
                            android:layout_width="match_parent"
                            android:layout_marginTop="10dp"
                            android:layout_height="wrap_content"
                            android:contentDescription="@string/certificate_icon"
                            android:layout_centerHorizontal="true"
                            android:src="@drawable/certification" />

                        <TextView
                            android:id="@+id/certification_2"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_below="@id/certification_img"
                            android:layout_centerHorizontal="true"
                            android:fontFamily="@font/open_sans"
                            android:padding="10dp"
                            android:text="@string/android_basics_nanodegree_by_google"
                            android:textColor="@color/white"
                            android:textSize="18sp"
                            android:textStyle="bold" />

                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_below="@id/certification_2"
                            android:fontFamily="@font/open_sans"
                            android:paddingBottom="10dp"
                            android:layout_centerHorizontal="true"
                            android:text="Certified on July,2019 "
                            android:textColor="@color/white"
                            android:textSize="16sp"
                            android:textStyle="italic"
                            tools:ignore="HardcodedText" />
                    </RelativeLayout>
                </LinearLayout>
       </ScrollView>
    </androidx.constraintlayout.widget.ConstraintLayout>
</FrameLayout>

Here is main activity for the fragments!

<androidx.constraintlayout.widget.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"
    tools:context=".More_Info">

    <LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:layout_constraintTop_toTopOf="parent"
    android:orientation="horizontal"
    android:layout_marginTop="15dp"
    android:id="@+id/more_cv_ll">

    <RelativeLayout
        android:layout_weight="1"
        android:id="@+id/rl_1"
        android:layout_marginTop="15dp"
        android:layout_marginStart="15dp"
        android:layout_width="100dp"
        android:layout_marginBottom="15dp"
        android:background="@drawable/bg_buttons"
        android:layout_height="100dp">

    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/education"
        android:layout_centerInParent="true"/>
    </RelativeLayout>

    <RelativeLayout
        android:layout_weight="1"
        android:id="@+id/rl_2"
        android:layout_marginStart="15dp"
        android:layout_width="100dp"
        android:layout_height="100dp"
        android:layout_marginTop="15dp"
        android:background="@drawable/bg_buttons"
        android:layout_marginBottom="15dp"
        android:layout_toRightOf="@id/rl_1">

        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerInParent="true"
            android:src="@drawable/skills" />
    </RelativeLayout>

    <RelativeLayout
        android:id="@+id/rl_3"
        android:layout_weight="1"
        android:layout_marginStart="15dp"
        android:layout_width="100dp"
        android:layout_height="100dp"
        android:layout_marginTop="15dp"
        android:layout_marginBottom="15dp"
        android:background="@drawable/bg_buttons"
        android:layout_toRightOf="@id/rl_2">

        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/work_exp"
            android:layout_centerInParent="true"/>
    </RelativeLayout>

    <RelativeLayout
        android:id="@+id/rl_4"
        android:layout_weight="1"
        android:layout_marginEnd="15dp"
        android:layout_marginStart="15dp"
        android:layout_width="100dp"
        android:layout_height="100dp"
        android:layout_marginBottom="15dp"
        android:background="@drawable/bg_buttons"
        android:layout_marginTop="15dp"
        android:layout_toRightOf="@id/rl_3">
        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/contact"
            android:layout_centerInParent="true"/>
    </RelativeLayout>

</LinearLayout>

    <FrameLayout
        android:id="@+id/cv_frame"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="top"
        android:layout_marginTop="15dp"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@id/more_cv_ll" />

</androidx.constraintlayout.widget.ConstraintLayout>


Solution 1:[1]

ScrollView must have only 1 child. Currently you have a Linear and a Relative Layout inside it. Make sure to have only 1 layout group inside scrollview eg LinearLayout and then add your views to that LinearLayout

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Daniyal Javaid