如何解决当 EditText 的输入类型为密码时,Android 回话宣布 TextInputLayout 的内容描述不正确
我的 Android 应用中有一个具有以下结构的 TextInputLayout。
<com.google.android.material.textfield.TextInputLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:imeOptions="actionDone"
android:id="@+id/mEdit"
android:inputType="numberPassword"
android:maxLength="4"
android:singleLine="true"
app:layout_constraintTop_toTopOf="parent" />
</com.google.android.material.textfield.TextInputLayout>
这里 maxLength
的 EditText
是 4。但是,在启用对话后,如果我们尝试在密码字段中编辑某些内容,即使我们没有达到 { maxLength
中的 {1}}。
预先感谢您提出宝贵意见。
解决方法
在 com.google.android.material.textfield.TextInputEditText
中使用 EditText
而不是 TextInputLayout
。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。