如何在EditText中显示setError的文本错误不可聚焦?用户不要修改此EditText非常重要,它将针对应用程序进行修改。也许我有另一种选择不同于focusable = false?
现在,我拥有它:
<EditText
android:id="@+id/date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="true"
android:ems="10"
android:focusable="false"
android:inputType="text"
android:onClick="onClick" />
非常感谢!
答案 0 :(得分:1)
最后我认为不可能......因为第一个必要条件是阻止文本,使用focusable = false或使用TextView来执行它,并且它还会阻止功能setError。
具有focusable = false的editText我可以得到一个右绘图(默认的红色感叹号)但没有文本。出于这个原因,我终于用Toast添加了文本。
这不完全是我想要的,但它是最相似的。
感谢您的帮助!
答案 1 :(得分:0)
只需使用TextView,如果您在某处出现错误,则使用drawableRight显示图像。 以下是以编程方式执行的示例:https://stackoverflow.com/a/7380789/3864698