Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android TextInputLayout Password toggle not visible in new support library

I have compiled with following design library and it is displaying password HIDE/SHOW button at the right of EditText

compile 'com.android.support:design:24.2.1'

<android.support.design.widget.TextInputLayout
    android:id="@+id/login_password_text_input_layout"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginTop="@dimen/spacing_normal">

    <android.support.v7.widget.AppCompatEditText
        android:id="@+id/login_password_edit_text"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:drawablePadding="@dimen/spacing_micro"
        android:hint="@string/prompt_password"
        android:imeActionId="@+id/login"
        android:imeActionLabel="@string/action_sign_in_short"
        android:imeOptions="actionUnspecified"
        android:inputType="textPassword"
        android:maxLines="1"
        android:text="password" />

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

like:

enter image description here

after updating to

compile 'com.android.support:design:25.0.1'

Its not visible, Why? Is there any bug?

Please guide.

like image 499
Pratik Butani Avatar asked Dec 12 '16 10:12

Pratik Butani


People also ask

How do I toggle visibility password in Android?

There are five XML attributes associated with the password visibility toggle. passwordToggleEnabled: This attribute has its value either true or false, so when we want the password to be toggleable, we should assign this attribute the true value. passwordToggleTint: allows giving the color the visibility toggle icon.

How do I get TextInputLayout from text?

TextInputLayout textInputCustomEndIcon = findViewById(R. id. editText); final TextInputEditText editText = new TextInputEditText(textInputCustomEndIcon. getContext()); textInputCustomEndIcon.


1 Answers

Add endIconMode to Custom for adding drawable end for a textinputlayout.

<com.google.android.material.textfield.TextInputLayout app:endIconMode="custom" app:endIconDrawable="@drawable/ic_tick_grey" .... </com.google.android.material.textfield.TextInputLayout>

like image 94
Dino Sunny Avatar answered Oct 03 '22 00:10

Dino Sunny