TextInputLayout.java 文件源码

java
阅读 33 收藏 0 点赞 0 评论 0

项目:material-components-android 作者:
/**
 * Returns whether the password visibility toggle functionality is enabled or not.
 *
 * <p>When enabled, a button is placed at the end of the EditText which enables the user to switch
 * between the field's input being visibly disguised or not.
 *
 * @param enabled true to enable the functionality
 * @attr ref android.support.design.R.styleable#TextInputLayout_passwordToggleEnabled
 */
public void setPasswordVisibilityToggleEnabled(final boolean enabled) {
  if (passwordToggleEnabled != enabled) {
    passwordToggleEnabled = enabled;

    if (!enabled && passwordToggledVisible && editText != null) {
      // If the toggle is no longer enabled, but we remove the PasswordTransformation
      // to make the password visible, add it back
      editText.setTransformationMethod(PasswordTransformationMethod.getInstance());
    }

    // Reset the visibility tracking flag
    passwordToggledVisible = false;

    updatePasswordToggleView();
  }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号