问题
I have two EditTexts and I am applying validations on them. If the validations fail, I want to show all the error messages at once. At a time, I'm getting only one error message which is fixed to the bottom EditText field. How to show all the EditText error messages at once??
I am using the following code:
if(uname.matches(""))
username.setError("Email is required");
if(pwd.matches(""))
password.setError("Password is required");
my screen shot is:
回答1:
You have to setError(null) in else condition.
if(uname.matches(""))
username.setError("Email is required");
else
username.setError(null);
if(pwd.matches(""))
password.setError("Password is required");
else
password.setError(null);
来源:https://stackoverflow.com/questions/31963271/how-to-show-all-edittext-error-messages-at-once-in-android