TextField with setMaxLength() in read-only state

Hi guys! If I set setMaxLength() on a TextField when it shows me the TextField in read-only state and the text exceeds the length , it is painted red. How can I do to avoid that the TextField be shown red?

Remove the max length, it’s read only anyway. So validation isn’t really needed.