有没有办法强制 TextInputLayout 错误消息占用一行?
我试图放置 app:errorTextAppearance="@style/error_appearance"
在带有 error_appearance 样式的 TextInputLayout 上,其中包含:
<item name="android:maxLines">1</item>
<item name="android:ellipsize">end</item>
<item name="android:inputType">text</item>
它不起作用。但是,更改颜色有效。我不明白,mErrorView 只是一个 TextView,它应该可以工作。
最佳答案
您可以通过 id 获取错误 TextView
TextView errorView = textInputLayout.findViewById(R.id.textinput_error);
errorView.setMaxLines(1);
errorView.setSingleLine(true);
关于android - TextInputLayout 错误信息大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40706163/