Dale Julian
Dale Julian

Reputation: 1588

app:passwordToggleEnabled="true" not working

I am trying to implement a login page and this is my TextInputLayout for the password field.

<android.support.design.widget.TextInputLayout
        android:id="@+id/password"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginLeft="15dp"
        android:layout_marginRight="15dp"
        android:hint="Password"
        app:passwordToggleDrawable="@drawable/eye_outline"
        android:theme="@style/GFSTextInputLayoutTheme"
        app:passwordToggleEnabled="true">

        <EditText
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:inputType="textPassword"
            android:textColor="@color/black"
            android:textColorHint="@color/light_grey"
            android:textSize="20dp" />

    </android.support.design.widget.TextInputLayout>

But somehow the app:passwordToggleEnabled="true" doesn't seem to work.

enter image description here

Here are my gradle imports:

compile 'com.android.support:design:27.1.1'
compile 'com.android.support:support-v4:27.1.1'
compile 'com.android.support:appcompat-v7:27.1.1'
compile 'com.android.support:recyclerview-v7:27.1.1'
compile 'com.android.support:support-vector-drawable:27.1.1'
compile 'com.android.support.constraint:constraint-layout:1.1.0'
compile 'com.android.support:recyclerview-v7:27.1.1'
compile 'com.android.support:cardview-v7:27.1.1'

Edit:

styles.xml

<style name="GFSTextInputLayoutTheme" parent="TextAppearance.AppCompat">
    <!-- Hint color and label color in FALSE state -->
    <item name="android:textColorHint">@color/light_grey</item>
    <!-- Label color in TRUE state and bar color FALSE and TRUE State -->
    <item name="colorAccent">@color/light_grey</item>
    <item name="colorControlNormal">@color/light_grey</item>
    <item name="colorControlActivated">@color/gfs_blue</item>
</style>

Any idea why this isn't working?

Upvotes: 3

Views: 7784

Answers (2)

Dale Julian
Dale Julian

Reputation: 1588

It was there all this time but it was white so I couldn't see it. I just included this one line of code:

app:passwordToggleTint="@color/blue"

enter image description here

Upvotes: 5

Taiyab Ranapur
Taiyab Ranapur

Reputation: 21

Dear @Dale Julian there is no need to put app:passwordToggleDrawable="@drawable/eye_outline". Android will take it directly from android resources.

Upvotes: 2

Related Questions