elementstyle elementstyle - 3 months ago 223
Android Question

Remove show password icon in Android N

New Android version automatically draws show password icon when I set

android:inputType="textPassword"
in EditText view. How can I disable it? Thanks

enter image description here

Answer

The password icon (or eye-icon) use be removed with the method setPasswordVisibilityToggleEnabled or with app:passwordToggleEnabled through XML.

For more information see support library revisions.

Example:

    <android.support.design.widget.TextInputLayout
        android:id="@+id/new_password_layout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:errorEnabled="true"
        app:passwordToggleEnabled="false">

        <EditText
            android:id="@+id/password_edit"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:hint="@string/new_password"
            android:imeOptions="actionNext"
            android:inputType="textPassword"
            android:singleLine="true"/>

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