Search code examples
kotlinunderlineandroid-textinputedittext

How to remove TextInputEditText error underline (not the base underline) in Kotlin. What is the name of the property?


I need to remove the error underline in a TextInputEditText in Kotlin, but is not the base underline. It shows in red below the text over the base underline when the text has some syntax or spelling error.

At least please tell my the name of the property that make this behavior.

This is an example image:

enter image description here

My Layout XML is as follows:

<com.google.android.material.textfield.TextInputLayout
        android:id="@+id/inputLayout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginHorizontal="20dp"
        android:layout_marginVertical="20dp"
        android:layout_marginTop="10dp"
        app:helperTextEnabled="true"
        app:helperTextTextColor="@color/red">

        <com.google.android.material.textfield.TextInputEditText
            android:id="@+id/newfolder"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:hint="Enter New Folder"
            android:imeOptions="actionNext"
            android:inputType="text"
            android:maxLength="32"
            android:scrollIndicators="bottom"
            android:scrollbars="horizontal"
            android:scrollHorizontally="true" />
    </com.google.android.material.textfield.TextInputLayout>

Solution

  • The solution to remove the Red underline it was just to add the following to the EdiText or TextInputEditText:

    android:inputType="text|textNoSuggestions"

    The key was "textNoSuggestions"