Inzimam Tariq IT
Inzimam Tariq IT

Reputation: 6748

endIconTint in TextInputLayout is not working

I'm creating a login form with TextInputLayout and TextInputEditText but toggle password icon always show in white no matter which color I assign to it as endIconTint. I have tested this on

Android 6
Android 10

both show the same results.

Here is my Form when I use Widget.MaterialComponents.TextInputLayout.OutlinedBox as a style in TextInputLayout. It seems like its not showing drawable but that's not the case its not visible as drawable & input field background color is white. When I click on the end it toggle password. enter image description here

Here is the form when I use Widget.MaterialComponents.TextInputLayout.FilledBox

enter image description here

And here is my code you can see I'm currently assigning black color to the endIconTint

<com.google.android.material.textfield.TextInputLayout
        android:id="@+id/password_til"
        style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="@dimen/activity_vertical_margin"
        android:hint="Password"
        app:counterEnabled="true"
        app:counterMaxLength="20"
        app:endIconMode="password_toggle"
        app:endIconTint="@color/black"
        app:helperText="required*"
        app:helperTextTextColor="@android:color/holo_red_dark"
        app:layout_constraintTop_toBottomOf="@id/username_til"
        app:passwordToggleEnabled="true"
        app:startIconDrawable="@drawable/ic_key">

        <com.google.android.material.textfield.TextInputEditText
            android:id="@+id/password_tiet"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:inputType="textPassword"
            android:maxLength="20" />
    </com.google.android.material.textfield.TextInputLayout>

I cross verified color from the color.xml file and tried other colors too but icon always appear as white. Please let me know what is wrong here or is it a bug?

Thanks & Regards

Upvotes: 1

Views: 859

Answers (1)

Nikunj
Nikunj

Reputation: 4157

You have already specify app:endIconMode="password_toggle" so you don't require to set passwordToggleEnabled anymore.

Remove this from TextInputLayout and it resolve your issue.

app:passwordToggleEnabled="true"

Upvotes: 4

Related Questions