S.A.Norton Stanley S.A.Norton Stanley - 1 year ago 343
Android Question

Programmatically set TextInputLayout Hint Text Color and Floating Label Color

I use a TextInputLayout, I would want to programmatically set the hint text color and the floating label color if the input field is mandatory. Before moving to TextInputLayout I used to set the hint text color programmatically using the following


Can someone guide me on how to set the hint text color and the floating label color programmatically for a TextInputLayout.

In the screenshot attached i would want the hint text Address 1 to be in red when not focused and the on focus the floating label Address 1 should be in red.

enter image description here

Answer Source

I was able to get the FloatingLabel in red using the following

textInputLayout.setError(" ");

enter image description here

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download