Search code examples
androidxmlandroid-studioandroid-edittextmaterial-design

How to remove EditText material design bottom line in android?


I am using material design 'com.google.android.material:material:1.3.0' in my Android app ( just to add password toggle for password field). I don't want other material features being included to my EditText.As you can see on the screenshot, green line appears when PasswordEditText is touched. How can i get it rid of and leave only password toggle among material design features? I tried to use app:boxBackgroundMode="none" app:boxStrokeWidth="0dp" app:boxStrokeWidthFocused="0dp" app:boxStrokeColor="@android:color/transparent" to remove the line but it didn't help.

enter image description here

Here is XML of Material design EditText:

<com.google.android.material.textfield.TextInputLayout
    android:id="@+id/editTextTextPersonName2"
    android:layout_width="match_parent"
    android:layout_marginTop="36dp"
    android:layout_marginRight="46dp"
    android:layout_marginLeft="46dp"
    android:paddingLeft="5dp"
    android:layout_height="wrap_content"
    app:hintEnabled="false"
    app:boxBackgroundMode="none"
    app:boxStrokeWidth="0dp"
    app:boxStrokeWidthFocused="0dp"
    app:boxStrokeColor="@android:color/transparent"
    android:ems="10"
    android:background="@drawable/edit_text_background"
    app:passwordToggleEnabled="true"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintHorizontal_bias="0.503"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toBottomOf="@+id/editTextTextPersonName">
    <com.google.android.material.textfield.TextInputEditText
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:textInputLayoutFocusedRectEnabled="false"
        android:hint="Parol"
        android:textSize="20sp"
        android:drawableStart="@drawable/ic_baseline_security_24"
        android:paddingBottom="10dp"
        android:paddingTop="10dp"
        android:inputType="textPassword"
        android:drawablePadding="5dp"/>
</com.google.android.material.textfield.TextInputLayout>

Solution

  • Set android:background="@null in the TextInputEditText