最佳答案
您可以使用 https://github.com/VenomVendor/Password-Strength-Checker满足您的要求
或使用 TextWatcher用于检查EditText长度。像这样
public void afterTextChanged(Editable s)
{
if(s.length()==0)
textViewPasswordStrengthIndiactor.setText("Not Entered");
else if(s.length()<6)
textViewPasswordStrengthIndiactor.setText("EASY");
else if(s.length()<10)
textViewPasswordStrengthIndiactor.setText("MEDIUM");
else if(s.length()<15)
textViewPasswordStrengthIndiactor.setText("STRONG");
else
textViewPasswordStrengthIndiactor.setText("STRONGEST");
if(s.length()==20)
textViewPasswordStrengthIndiactor.setText("Password Max Length Reached");
}
};
afterTextChanged (Editable s) - This method is called when the text has been changed. Because any changes you make will cause this method to be called again recursively, you have to be watchful about performing operations here, otherwise it might lead to infinite loop.
关于带搜索栏的 Android 密码强度检查器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32883969/