Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TextInputLayout error message size

Is there a way to force the TextInputLayout error message to take a single line ?

I tried to place app:errorTextAppearance="@style/error_appearance" on the TextInputLayout with the error_appearance style containing :

<item name="android:maxLines">1</item>
<item name="android:ellipsize">end</item>
<item name="android:inputType">text</item>

and it does not work. Changing the color works however. I don't get it, the mErrorView is just a TextView, it should work.

TextInputLayout error message

like image 449
andrei Avatar asked Dec 06 '22 16:12

andrei


1 Answers

you can fetch error TextView by id

TextView errorView = textInputLayout.findViewById(R.id.textinput_error);
errorView.setMaxLines(1);
errorView.setSingleLine(true);
like image 90
kjurkovic Avatar answered Dec 27 '22 22:12

kjurkovic