edwinnurek
edwinnurek

Reputation: 155

Remove edittext indicator (underline) - Material Design

I need to remove underline of TextInputLayout. Its almost removed but showing little parts on start and on the end (black). It shows only when activated Screen below

enter image description here

style:

<style name="EditTextLoginRegister" parent="Widget.MaterialComponents.TextInputLayout.FilledBox">
        <item name="boxCornerRadiusBottomEnd">8dp</item>
        <item name="boxCornerRadiusBottomStart">8dp</item>
        <item name="boxCornerRadiusTopEnd">8dp</item>
        <item name="boxCornerRadiusTopStart">8dp</item>
        <item name="boxStrokeWidth">0dp</item>
        <item name="boxStrokeColor">@android:color/transparent</item>
        <item name="boxBackgroundColor">@color/grey</item>
        <item name="android:textColorHint">@color/greyLight2</item>
        <item name="startIconTint">@color/greyLight2</item>
        <item name="endIconTint">@color/greyLight2</item>
        <item name="hintTextColor">@color/violet</item>
    </style>

and the TextInputLayout:

<com.google.android.material.textfield.TextInputLayout
        android:id="@+id/tl_email_login"
        style="@style/EditTextLoginRegister"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginStart="24dp"
        android:layout_marginTop="16dp"
        android:layout_marginEnd="24dp"
        android:hint="@string/e_mail"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/tv_header_login"
        app:startIconDrawable="@drawable/ic_user">

        <com.google.android.material.textfield.TextInputEditText
            android:id="@+id/et_email_login"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:inputType="textEmailAddress"
            android:textColor="@color/greyLight" />

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

Upvotes: 2

Views: 522

Answers (1)

Entreco
Entreco

Reputation: 12900

Try adding boxStrokeWidthFocused to your style

<style name="EditTextLoginRegister" parent="Widget.MaterialComponents.TextInputLayout.FilledBox">
    <!-- Other attributes -->
    <item name="boxStrokeWidthFocused">0dp</item>

</style>

Admittedly, this is the most difficult part -> styling Material design views. In Android Studio, it is possible to get AutoComplete options, and I usually go through the complete list and try out various items.

enter image description here

Upvotes: 4

Related Questions