Android password visibility toggle not working with support library 25?
Try it this way.
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:passwordToggleEnabled="true">
<EditText
android:id="@+id/returning_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/prompt_password"
android:inputType="textPassword"
android:maxLines="1"
android:textSize="14sp" />
</android.support.design.widget.TextInputLayout>
This might be helpful for you!!
The TextInputLayout password toggle is now disabled by default to avoid unnecessarily overwriting developer-specified end drawables. It may be manually enabled via the passwordToggleEnabled XML attribute.
Recent Support Library Revisions
if you use Jetpack then
add these dependencies
implementation 'com.google.android.material:material:1.0.0'
and add app:passwordToggleEnabled="true"
in xml
and one more thing, use inputType= textPassword
and if you use rather than this then toggle button won't be shown.
Instead of using
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:passwordToggleEnabled="true">
<EditText
android:id="@+id/returning_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/prompt_password"
android:inputType="textPassword"
android:maxLines="1"
android:textSize="14sp" />
</android.support.design.widget.TextInputLayout>
, you need to use
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:passwordToggleEnabled="true">
<EditText
android:id="@+id/returning_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/prompt_password"
android:inputType="textPassword"
android:maxLines="1"
android:textSize="14sp" />
</com.google.android.material.textfield.TextInputLayout>