gpt4 book ai didi

android - TextInputLayout 错误信息大小

转载 作者:行者123 更新时间:2023-12-04 23:46:17 32 4
gpt4 key购买 nike

有没有办法强制 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,它应该可以工作。

TextInputLayout error message

最佳答案

您可以通过 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/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com