TextInputLayout工作正常,但尝试设置错误时会显示错误。
代码:
if (etFirstName.getText().length() == 0) {
etFirstName.requestFocus();
tvFirstName.setError("Please enter firstname");
} else {
tvFirstName.setError(null);
tvFirstName.setErrorEnabled(false);
}
检查日志:
java.lang.RuntimeException: Failed to resolve attribute at index 24
at android.content.res.TypedArray.getColor(TypedArray.java:401)
at android.widget.TextView.<init>(TextView.java:692)
at android.widget.TextView.<init>(TextView.java:629)
at android.widget.TextView.<init>(TextView.java:625)
at android.widget.TextView.<init>(TextView.java:621)
at android.support.design.widget.TextInputLayout.setErrorEnabled(TextInputLayout.java:297)
at android.support.design.widget.TextInputLayout.setError(TextInputLayout.java:344)