By default, the setError
makes an EditText
look like the following:
There's a red exclamation. The error message pops-up when that particular EditText
gains focus.
I'm creating a custom setError
method:
validatedIcon = ContextCompat.getDrawable(getApplicationContext(), R.drawable.validated);
validatedIcon.setBounds(0, 0, validatedIcon.getIntrinsicWidth(), validatedIcon.getIntrinsicHeight());
firstName.setError("Please check your first name",validatedIcon);
My new error icon is a custom icon. But I don't want the error message to be displayed with it. I tried passing null as the message, but that removed the whole icon. I tried passing the empty string, but that simply made an empty box.
Alternative tried: I tried setting the icon using setCompoundDrawablesWithIntrinsicBounds
, but even after much hair-pulling, it didn't work properly.
So, is there a way to get rid of the message-box in setError
?