admin管理员组

文章数量:1405170

I'm trying to make a TextInputEditText with maxLines = 10 be scollable in a way that when it's done scrolling, the parent should scroll but I can't get it to work.

The TextInputEditText behaves as if it didn't have anything to scroll. Is this possible to accomplish this?

If I want to scroll the text, I need to click on it first and then drag the handle which is very annoying and bad UX.

Here's what I have:

<?xml version="1.0" encoding="utf-8"?>
<androidx.core.widget.NestedScrollView xmlns:android=";
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fillViewport="true">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:padding="16dp">

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

            <com.google.android.material.textfield.TextInputEditText
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:gravity="top|start"
                android:inputType="textMultiLine"
                android:maxLines="10"
                android:overScrollMode="always"
                android:scrollbars="vertical" />

        </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="16dp">

            <com.google.android.material.textfield.TextInputEditText
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:gravity="top|start"
                android:inputType="textMultiLine"
                android:maxLines="10"
                android:overScrollMode="always"
                android:scrollbars="vertical" />

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

</androidx.core.widget.NestedScrollView>

本文标签: androidHow to scroll a TextInputEditText inside a ScrollViewNestedScrollViewStack Overflow