프로그래밍 방식으로 TextInputEditText
을 만들고 을 textPassword
으로 설정하면 올바르게 작동합니다. 그러나 마지막 지원 라이브러리의 문제는 비밀번호 전환보기를 표시하기 위해 app:passwordToggleEnabled="true"
을 추가해야합니다.프로그래밍 방식으로 passwordToggleEnabled를 설정하는 방법
프로그래밍 방식으로 설정하는 방법은 무엇입니까?
프로그래밍 방식으로 TextInputEditText
을 만들고 을 textPassword
으로 설정하면 올바르게 작동합니다. 그러나 마지막 지원 라이브러리의 문제는 비밀번호 전환보기를 표시하기 위해 app:passwordToggleEnabled="true"
을 추가해야합니다.프로그래밍 방식으로 passwordToggleEnabled를 설정하는 방법
프로그래밍 방식으로 설정하는 방법은 무엇입니까?
TextInputLayout
에 랩핑 한 다음 토글을 프로그래밍 방식으로 사용/사용하지 않도록 설정할 수 있습니다.
textInputLayout.setPasswordVisibilityToggleEnabled()
는 IIRC이 어떤 이유로 설계 라이브러리의 이전 버전에서는 사용할 수 없었던, 그러나 나중에 업데이트를 추가했다. 최신 버전 (25.1.0)을 사용하고 있는지 확인하십시오.
이 시도 .. 또한
if (textInputEditText.getTransformationMethod() == null) {
textInputEditText.setTransformationMethod(new PasswordTransformationMethod());
textInputEditText.setSelection(textInputEditText.getText().length());
} else {
textInputEditText.setTransformationMethod(null);
textInputEditText.setSelection(textInputEditText.getText().length());
}
당신이 시도 할 수 있습니다이 :
textInputLayout.setPasswordVisibilityToggleEnabled(true);
가 네이 내가 문서에 마지막 에 한 일을'(참) txtInput.setPasswordVisibilityToggleEnabled입니다'가능 'TextInputLayout'에 대해서만 감사합니다. –