Nouman Baig
Nouman Baig

Reputation: 64

Scrollview is not scrolling in new androidx project

I have added a scrollview in my new android studio project which is running on androidx support library but the problem is scrollview and nested scrollview is not at all scrolling in the activity where as it used to scroll in old projects. What is the problem? Please help. I have tried all the possible causes from my end and as well as searched for the same but I couldn't able to find the solution.

<ScrollView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fillViewport="true"
    android:scrollbars="none">


    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:orientation="vertical"
        android:padding="20dp">


        <FrameLayout
            android:layout_width="match_parent"
            android:layout_height="150dp">

            <de.hdodenhof.circleimageview.CircleImageView
                android:id="@+id/img_user"
                android:layout_width="100dp"
                android:layout_height="100dp"
                android:layout_gravity="center"
                android:src="@mipmap/icon_user_three"
                app:civ_border_color="@color/colorAccent"
                app:civ_border_width="2dp" />

            <LinearLayout
                android:id="@+id/layout_edit"
                android:layout_width="35dp"
                android:layout_height="35dp"
                android:layout_gravity="center"
                android:layout_marginLeft="30dp"
                android:layout_marginTop="35dp"
                android:background="@drawable/white_circle"
                android:gravity="center">


                <ImageView
                    android:layout_width="20dp"
                    android:layout_height="20dp"
                    android:src="@drawable/ic_edit"
                    android:tint="@color/white" />
            </LinearLayout>
        </FrameLayout>


        <com.google.android.material.textfield.TextInputLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <com.awt.jobstreamers.utils.CustomFontEditText
                android:id="@+id/edt_mobile"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:hint="@string/email_mobile"
                android:imeOptions="actionNext"
                android:inputType="textEmailAddress"
                android:transitionName="edittext" />

        </com.google.android.material.textfield.TextInputLayout>

        <com.google.android.material.textfield.TextInputLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="10dp"
            android:layout_marginBottom="10dp">

            <com.awt.jobstreamers.utils.CustomFontEditText
                android:id="@+id/edt_firstName"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:hint="@string/first_name"
                android:imeOptions="actionNext"
                android:inputType="textCapWords"
                android:transitionName="edittext" />

        </com.google.android.material.textfield.TextInputLayout>

        <com.google.android.material.textfield.TextInputLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <com.awt.jobstreamers.utils.CustomFontEditText
                android:id="@+id/edt_lastName"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:hint="@string/last_name"
                android:imeOptions="actionDone"
                android:inputType="textCapWords"
                android:transitionName="edittext" />

        </com.google.android.material.textfield.TextInputLayout>

        <com.awt.jobstreamers.utils.CustomFontButton
            android:id="@+id/btn_finish"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="40dp"
            android:layout_marginBottom="20dp"
            android:background="@drawable/yellow_button_background_two"
            android:text="@string/finish"
            android:textAllCaps="false"
            android:textColor="@color/white"
            android:textSize="16sp"
            android:textStyle="bold"
            android:transitionName="button" />


    </LinearLayout>
</ScrollView>

Upvotes: 1

Views: 2294

Answers (1)

wasim.shariff
wasim.shariff

Reputation: 607

If you are using androidx library use androidx widgets:

Try using nested scrollview like this

<androidx.core.widget.NestedScrollView
    android:layout_width="match_parent"
    android:layout_height="match_parent">

</androidx.core.widget.NestedScrollView>

Upvotes: 1

Related Questions