Remove underline from TextInputEditText

Sagar Jogadia picture Sagar Jogadia · Jul 16, 2019 · Viewed 14.9k times · Source

I have an android screen which takes email from the user. Below is the snippet of the code, I want to remove the underline which appears below the text.

<com.google.android.material.textfield.TextInputLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_margin="8dp"
    android:hint="@string/email"
    android:textColorHint="@color/blueBackground"
    app:boxBackgroundColor="@color/input_background"
    app:boxCornerRadiusBottomEnd="20dp"
    app:boxCornerRadiusBottomStart="20dp"
    app:boxCornerRadiusTopEnd="20dp"
    app:boxCornerRadiusTopStart="20dp"
    app:endIconMode="clear_text"
    app:endIconTint="@color/blueBackground"
    app:hintTextColor="@color/blueBackground">

    <com.google.android.material.textfield.TextInputEditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:textColor="@color/blueBackground"
        android:textSize="18sp"
        android:layout_margin="8dp" />

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

I have tried android:background="@null" and

<item name="colorControlNormal">@android:color/transparent</item> <item name="colorControlActivated">@android:color/transparent</item>

But it is not working.

EditText

Answer

Gunavant Patel picture Gunavant Patel · Jun 27, 2020

If you want to use the filled box then below code perfectly work for me.

app:boxStrokeWidth="0dp"
app:boxStrokeWidthFocused="0dp"

add above lines in the input layout.