我注意到自从几天前开始,我所有的TextInputLayouts都一直启用“错误感叹号”。我很久以前就没有改变任何有关那些TextInputLayouts的东西,所以我真的不明白发生了什么事情。
这是它的外观截图: 你有什么想法是这个问题的根源吗?最近有什么关于TextInputLayouts的更新吗?
非常感谢您的帮助。
编辑: 这是相关代码: .xml文件非常简单。像这样列出了许多TextInputLayouts和EditTexts:
这是它的外观截图: 你有什么想法是这个问题的根源吗?最近有什么关于TextInputLayouts的更新吗?
非常感谢您的帮助。
编辑: 这是相关代码: .xml文件非常简单。像这样列出了许多TextInputLayouts和EditTexts:
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/default_margin"
android:layout_marginTop="@dimen/default_margin"
android:layout_marginRight="@dimen/default_margin">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/txtAddressTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/PROFILE_SCREEN_ADDRESS_INPUT_TITLE"
android:inputType="textPersonName|textCapWords" />
</com.google.android.material.textfield.TextInputLayout>
此外,在我的 Kotlin 代码中完全没有提到 setError()。
TextInputLayout
的错误提示是在EditText
下方的一个TextView
。这看起来像是直接在EditText
上调用了setError()
,而不是在TextInputLayout
上调用。 - Mike M.editText.error = ...
。 - Mike M.