我想在TextinputLayout中设置显示错误发生时的错误endicon。我该怎么办?
Emailtext.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
}
@Override
public void onTextChanged(CharSequence charSequence, int start, int before, int count) {
if(charSequence.length()<5)
{
EmailLayout.setError("Error is occur");
EmailLayout.setEndIconDrawable(R.drawable.baseline_info_black_48);
EmailLayout.setEndIconActivated(true);
EmailLayout.setEndIconContentDescription("Error icon");
}
else
{
EmailLayout.setErrorEnabled(false);
}
}
答案 0 :(得分:0)
在其他情况下,
EmailLayout.setError(null);