How can I change the colour of the error message that can be set to appear below the text field in a TextInputLayout (via setError(...) – see error
Depending on need, one can change/set TextInputLayout text color dynamically or directly in the layout XML file. Below is sample code snippets
Create a custom style which uses @android:style/TextAppearance as parent in your styles.xml file:
And, use it in your TextInputLayout widget:
- Directly in XML Layout
- Dynamically in your class
your_input_layout.setErrorTextAppearance(R.style.style_error_appearance);
If you want to set single/same error text color for your application then define the text color in your app theme
And in your AndroidManifest.xml: