Android ScrollView LinearLayout not scrolling

  Kiến thức lập trình

I have a scrollview, a linearlayout inside it, and other layout and textinputlayout components inside the linearlayout. But when I open the keyboard, my textinputedittexts at the bottom of keyboard cannot be scrolled. I tried the adjustResize and adjustPan keys in the manifest file, but they did not work either. My problem here is that ScrollView does not work at all.

CODE:

<?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"
    android:paddingHorizontal="20dp"
    tools:context=".presentation.view.RegisterFragment">


        <LinearLayout
            android:id="@+id/linearLayout2"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:gravity="center_horizontal"
            android:layout_gravity="center"
            android:orientation="vertical">

            <TextView
                android:id="@+id/textView5"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:fontFamily="@font/inter_bold"
                android:text="@string/registerMainText"
                android:textColor="#1C1C1C"
                android:textSize="30sp"
                android:textStyle="bold"/>

            <TextView
                android:id="@+id/textView6"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:fontFamily="@font/inter_regular"
                android:text="@string/registerExpText"
                android:textColor="#676666"
                android:textSize="13sp"
                android:textStyle="normal" />

            <com.google.android.material.textfield.TextInputLayout
                android:id="@+id/usernameInputLayout"
                style="@style/Widget.Material3.TextInputLayout.OutlinedBox"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:hint="Kullanıcı Adı"
                app:boxCornerRadiusBottomEnd="16dp"
                app:boxCornerRadiusBottomStart="16dp"
                app:boxCornerRadiusTopEnd="16dp"
                app:boxCornerRadiusTopStart="16dp"
                app:boxStrokeColor="@color/green_main"
                app:counterMaxLength="14"
                app:cursorColor="@color/green_main"
                app:errorEnabled="true"
                app:errorIconDrawable="@drawable/ic_error"
                app:hintTextColor="@color/green_main">

                <com.google.android.material.textfield.TextInputEditText
                    android:id="@+id/usernameEdtTxt"
                    android:layout_width="match_parent"
                    android:layout_height="50dp"
                    android:drawableEnd="@drawable/ic_person"
                    android:maxLength="14"
                    android:maxLines="1"
                    android:textColor="#000000"
                    android:textSize="15sp" />
            </com.google.android.material.textfield.TextInputLayout>

            <com.google.android.material.textfield.TextInputLayout
                android:id="@+id/nameInputLayout"
                style="@style/Widget.Material3.TextInputLayout.OutlinedBox"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:hint="İsim"
                app:boxCornerRadiusBottomEnd="16dp"
                app:boxCornerRadiusBottomStart="16dp"
                app:boxCornerRadiusTopEnd="16dp"
                app:boxCornerRadiusTopStart="16dp"
                app:boxStrokeColor="@color/green_main"
                app:counterMaxLength="20"
                app:cursorColor="@color/green_main"
                app:errorEnabled="true"
                app:errorIconDrawable="@drawable/ic_error"
                app:hintTextColor="@color/green_main">

                <com.google.android.material.textfield.TextInputEditText
                    android:id="@+id/nameEdtTxt"
                    android:layout_width="match_parent"
                    android:layout_height="50dp"
                    android:drawableEnd="@drawable/ic_pen"
                    android:maxLength="20"
                    android:maxLines="1"
                    android:textColor="#000000"
                    android:textSize="15sp" />
            </com.google.android.material.textfield.TextInputLayout>

            <com.google.android.material.textfield.TextInputLayout
                android:id="@+id/emailInputLayout"
                style="@style/Widget.Material3.TextInputLayout.OutlinedBox"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:hint="Email"
                app:boxCornerRadiusBottomEnd="16dp"
                app:boxCornerRadiusBottomStart="16dp"
                app:boxCornerRadiusTopEnd="16dp"
                app:boxCornerRadiusTopStart="16dp"
                app:boxStrokeColor="@color/green_main"
                app:cursorColor="@color/green_main"
                app:errorEnabled="true"
                app:errorIconDrawable="@drawable/ic_error"
                app:hintTextColor="@color/green_main">

                <com.google.android.material.textfield.TextInputEditText
                    android:id="@+id/emailEdtTxt"
                    android:layout_width="match_parent"
                    android:layout_height="50dp"
                    android:drawableEnd="@drawable/ic_email"
                    android:inputType="textEmailAddress"
                    android:maxLines="1"
                    android:textColor="#000000"
                    android:textSize="15sp" />
            </com.google.android.material.textfield.TextInputLayout>

            <com.google.android.material.textfield.TextInputLayout
                android:id="@+id/passwordInputLayout"
                style="@style/Widget.Material3.TextInputLayout.OutlinedBox"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:hint="Şifre"
                app:boxCornerRadiusBottomEnd="16dp"
                app:boxCornerRadiusBottomStart="16dp"
                app:boxCornerRadiusTopEnd="16dp"
                app:boxCornerRadiusTopStart="16dp"
                app:boxStrokeColor="@color/green_main"
                app:counterMaxLength="20"
                app:cursorColor="@color/green_main"
                app:endIconMinSize="60dp"
                app:endIconMode="password_toggle"
                app:endIconTint="#494949"
                app:errorEnabled="true"
                app:hintTextColor="@color/green_main">

                <com.google.android.material.textfield.TextInputEditText
                    android:id="@+id/passwordEdtTxt"
                    android:layout_width="match_parent"
                    android:layout_height="50dp"
                    android:inputType="textPassword"
                    android:maxLength="20"
                    android:maxLines="1"
                    android:textColor="#000000"
                    android:textSize="15sp" />
            </com.google.android.material.textfield.TextInputLayout>

            <com.google.android.material.textfield.TextInputLayout
                android:id="@+id/phoneInputLayout"
                style="@style/Widget.Material3.TextInputLayout.OutlinedBox"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:hint="Telefon"
                app:boxCornerRadiusBottomEnd="16dp"
                app:boxCornerRadiusBottomStart="16dp"
                app:boxCornerRadiusTopEnd="16dp"
                app:boxCornerRadiusTopStart="16dp"
                app:boxStrokeColor="@color/green_main"
                app:counterMaxLength="15"
                app:cursorColor="@color/green_main"
                app:errorEnabled="true"
                app:errorIconDrawable="@drawable/ic_error"
                app:hintTextColor="@color/green_main"
                app:prefixText="+90">

                <com.google.android.material.textfield.TextInputEditText
                    android:id="@+id/phoneEdtTxt"
                    android:layout_width="match_parent"
                    android:layout_height="50dp"
                    android:drawableEnd="@drawable/ic_phone"
                    android:drawablePadding="5dp"
                    android:inputType="phone"
                    android:maxLength="15"
                    android:maxLines="1"
                    android:textColor="#000000"
                    android:textSize="15sp" />
            </com.google.android.material.textfield.TextInputLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal">

                <com.google.android.material.textfield.TextInputLayout
                    android:id="@+id/birthInputLayout"
                    style="@style/Widget.Material3.TextInputLayout.OutlinedBox"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_weight="0.8"
                    app:boxCornerRadiusBottomEnd="16dp"
                    app:boxCornerRadiusBottomStart="16dp"
                    app:boxCornerRadiusTopEnd="16dp"
                    app:boxCornerRadiusTopStart="16dp"
                    app:boxStrokeColor="@color/green_main"
                    app:cursorColor="@color/green_main"
                    app:errorEnabled="true"
                    app:errorIconDrawable="@drawable/ic_error"
                    app:hintTextColor="@color/green_main">

                    <com.google.android.material.textfield.TextInputEditText
                        android:id="@+id/birthEdtTxt"
                        android:layout_width="match_parent"
                        android:layout_height="50dp"
                        android:clickable="true"
                        android:cursorVisible="false"
                        android:drawableEnd="@drawable/ic_calendar"
                        android:focusable="false"
                        android:hint="Doğum Tarihi"
                        android:inputType="none"
                        android:maxLines="1"
                        android:textSize="15sp" />
                </com.google.android.material.textfield.TextInputLayout>

                <RadioGroup
                    android:id="@+id/radioGroupRegister"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="20dp"
                    android:layout_weight="1"
                    android:gravity="center"
                    android:orientation="horizontal">

                    <android.widget.RadioButton
                        android:id="@+id/radioBtnWomen"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center"
                        android:layout_marginEnd="8dp"
                        android:button="@drawable/radiobtn_selector"
                        android:text="Kadın" />

                    <android.widget.RadioButton
                        android:id="@+id/radioBtnMen"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center"
                        android:button="@drawable/radiobtn_selector"
                        android:text="Erkek" />
                </RadioGroup>

            </LinearLayout>

            <androidx.appcompat.widget.AppCompatButton
                android:id="@+id/registerBtn"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="@drawable/onboarding_button_green"
                android:fontFamily="@font/inter_semibold"
                android:gravity="center"
                android:text="FITGATHER'A KATIL!"
                android:textColor="@color/white"
                android:textSize="16sp"/>

            <LinearLayout
                android:id="@+id/linearLayout3"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:layout_marginTop="12dp"
                android:gravity="center"
                android:orientation="horizontal">

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginEnd="6dp"
                    android:fontFamily="@font/inter_regular"
                    android:text="Zaten bir hesabın mı var?" />

                <TextView
                    android:id="@+id/loginTxtBtn"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:fontFamily="@font/inter_bold"
                    android:text="Giriş yap"
                    android:textColor="@color/green_main" />
            </LinearLayout>

        </LinearLayout>

</ScrollView>

Did I make a bug here that prevents scrolling?

New contributor

Ogün Gezer is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website

LEAVE A COMMENT