Talkback reads Maximum length reached message even if EditText max length is no reached

64 Views Asked by At

When I set maxLength in a EditText I am getting "Maximum length reached" everytime I add a letter. I tried in several ways. Using EditText, AppCompatEditText and I also tried with a solution provided in some other threads like this. But it keeps doing the same.

I put my last attemp

<androidx.constraintlayout.widget.ConstraintLayout
    android:id="@+id/flInputContainer"
    android:layout_width="@dimen/match_constraint"
    android:layout_height="?spacing_100"
    android:background="@drawable/mbinputbasic_selector_outline_normal"
    android:focusable="false"
    app:layout_constraintEnd_toStartOf="@id/formTooltipBg"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toBottomOf="@id/formLabel">

    <com.mb.components.widget.MBImageView
        android:id="@+id/iconEnd"
        android:layout_width="?icon_60"
        android:layout_height="?icon_60"
        android:layout_marginStart="?spacing_50"
        android:clickable="false"
        android:focusable="false"
        android:padding="?spacing_40"
        android:visibility="gone"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        tools:src="@drawable/ic_sample"
        tools:visibility="visible" />

    <com.google.android.material.textfield.TextInputLayout
        android:layout_width="@dimen/match_constraint"
        android:layout_height="wrap_content"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toStartOf="@+id/iconEnd"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent">

        <com.google.android.material.textfield.TextInputEditText
            android:id="@+id/formInput"
            style="@style/MBInputTextInput"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:drawablePadding="?spacing_35"
            android:isScrollContainer="true"
            android:minHeight="?spacing_100"
            android:overScrollMode="always"
            android:paddingStart="?spacing_50"
            android:paddingTop="?spacing_40"
            android:paddingEnd="?spacing_50"
            android:paddingBottom="?spacing_40"
            android:scrollbarAlwaysDrawVerticaMBLablelTrack="true"
            android:scrollbarStyle="outsideOverlay"
            android:scrollbars="none"
            tools:text="Large name ultra spacing never surrending also there issomething in the wind" />
    </com.google.android.material.textfield.TextInputLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

I had to set the maxLength programmatically using the following code:

var maxLength: Int = 0
    set(value) {
        if (value != field) {
            field = value
            if (value != 0) {
                binding.formInput.filters = arrayOf(InputFilter.LengthFilter(value))
            }
        }
    }
0

There are 0 best solutions below