개발/개발하다가 알게된 것
[안드로이드] 비밀번호 입력에 보이기/숨기기 토글 기능 추가하기
미니소곰
2020. 2. 11. 23:11
액티비티 레이아웃 XML파일에 아래와 같이 추가하면 된다.
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:passwordToggleEnabled="true">
<EditText
android:id="@+id/signupActivity_edittext_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="PASSWORD"
android:inputType="textPassword" />
</com.google.android.material.textfield.TextInputLayout>
app:passwordToggleEnabled="true"을 EditText를 감싸고 있는 레이아웃에 추가해준다.