2

I want remove underline.

Picture showing an underline on Android

This is my code:

<com.google.android.material.textfield.TextInputLayout
    android:id="@+id/textInputLayoutName"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginTop="60dp"
    android:layout_marginStart="5dp"
    android:layout_marginEnd="5dp"
    app:boxCornerRadiusTopStart="20dp"
    app:boxCornerRadiusTopEnd="20dp"
    app:boxCornerRadiusBottomEnd="20dp"
    app:boxCornerRadiusBottomStart="20dp"
    >

    <com.google.android.material.textfield.TextInputEditText
        android:id="@+id/textInputEditTextName"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="@string/register_hint_name"
        android:inputType="text"
        android:textColor="@color/black" />

</com.google.android.material.textfield.TextInputLayout>
Zoe
  • 27,060
  • 21
  • 118
  • 148
Nikola
  • 49
  • 7

4 Answers4

1

set background like this:

android:background="@android:color/transparent"

or

android:background="@null"

you can also see this answer

m.sajjad.s
  • 711
  • 7
  • 19
0

just add android:background="" inside TextInputEditText

Mohamad_Dan
  • 106
  • 1
  • 4
0

You can also create a layout file for the background you wish and set it as: android:background="@layout/nameoffile"

0

You can set below attributes in TextInputLayout to have no width

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

Your layout

<com.google.android.material.textfield.TextInputLayout
    android:id="@+id/textInputLayoutName"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginTop="60dp"
    android:layout_marginStart="5dp"
    android:layout_marginEnd="5dp"
    app:boxCornerRadiusTopStart="20dp"
    app:boxCornerRadiusTopEnd="20dp"
    app:boxStrokeWidth="0dp"
    app:boxStrokeWidthFocused="0dp"
    app:boxCornerRadiusBottomEnd="20dp"
    app:boxCornerRadiusBottomStart="20dp">

    <com.google.android.material.textfield.TextInputEditText
        android:id="@+id/textInputEditTextName"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="@string/register_hint_name"
        android:inputType="text"
        android:textColor="@color/black" />

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

Preview

enter image description here

Zain
  • 37,492
  • 7
  • 60
  • 84