【发布时间】:2014-12-22 03:49:57
【问题描述】:
如何在不可聚焦的 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" />
非常感谢!
【问题讨论】:
-
或者不使用EditText?为什么不是 TextView?
-
或者设置android:editable="false"?
-
使用 EditText(并删除 focusable=false)我没有收到 setError 消息。
-
不幸的是 editable=false 不起作用。有了它,我可以显示我的错误消息,但实际上我可以编辑这个字段。我也试过 inputType=none (相同但不弃用),结果是一样的。
-
抱歉,在我 12 月 16 日 17:31 的评论中,我的意思是 TextView 而不是 EditText。
标签: android xml android-edittext focusable