An android small library to show and hide password in a EditText.
Download the latest version in JitPack or Gradle bellow
implementation 'com.github.pedrofsn:RevealPassword:1.0.2'
Using only XML:
<br.com.redcode.revealpassword.library.EditTextWithImageForRevealPassword
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:drawableRevealPassword="@android:drawable/ic_menu_add"
app:hint="Custom Hint Hardcoded" />
Using XML and JAVA/Kotlin:
<EditText
android:id="@+id/editTextSampleFunction"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:inputType="textWebPassword"
android:text="\@pedrofsn" />
<Button
android:id="@+id/buttonShowHidePassword"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Show/hide password" />
buttonShowHidePassword.setOnClickListener { editTextSampleFunction.showOrHidePassword() }
You can see more samples in XML and Java/Kotlin.
Attention: If you're using TextInputLayout from Material Components. You can use builtin solution for this problem domain.