I need an EditText that looks like this onError:
calling onError looks like this instead :

Note: the app is running on SDK 19 (4.4.2)
min SDK is 1
Is there a method similar to setError that does this automatically, or do I have to write the code for it ?
Thank you
There's no need to use a third-party library since Google introduced the
TextInputLayoutas part of thedesign-support-library.Following a basic example:
Layout
Note: By setting
app:errorEnabled="true"as an attribute of theTextInputLayoutit won't change it's size once an error is displayed - so it basically blocks the space.Code
In order to show the Error below the
EditTextyou simply need to call#setErroron theTextInputLayout(NOT on the childEditText):Result
To hide the error and reset the tint simply call
til.setError(null).Note
In order to use the
TextInputLayoutyou have to add the following to yourbuild.gradledependencies:Setting a custom color
By default the line of the
EditTextwill be red. If you need to display a different color you can use the following code as soon as you callsetError.To clear it simply call the
clearColorFilterfunction, like this: