Android 在宣布下一个TextInputLayout之前结束错误公告
我有一个带有TextInputLayout的表单,当它失去焦点时会执行一些验证。 我可以在用户单击键盘next时执行验证,在TextInputLayout中设置错误,但是错误的通知会被下一个字段的通知中断Android 在宣布下一个TextInputLayout之前结束错误公告,android,android-accessibility,Android,Android Accessibility,我有一个带有TextInputLayout的表单,当它失去焦点时会执行一些验证。 我可以在用户单击键盘next时执行验证,在TextInputLayout中设置错误,但是错误的通知会被下一个字段的通知中断 editText.setOnEditorActionListener { _, actionId, _ -> if (actionId == EditorInfo.IME_ACTION_NEXT || actionId == EditorInfo.IME_ACTI
editText.setOnEditorActionListener { _, actionId, _ ->
if (actionId == EditorInfo.IME_ACTION_NEXT || actionId == EditorInfo.IME_ACTION_DONE) {
if (!isErrorEnabled)
runOnLoseFocusValidation()
}
return@setOnEditorActionListener false
}
我试图使用post delay来触发下一个动作,但延迟时间需要根据对讲的语音速度而变化
editText.setOnEditorActionListener { _, actionId, _ ->
var result = false
if (actionId == EditorInfo.IME_ACTION_NEXT) {
//runOnLoseFocusValidation() return true if the input is invalid
if (!isErrorEnabled && runOnLoseFocusValidation()) {
result = true
Handler().postDelayed({
editText.onEditorAction(EditorInfo.IME_ACTION_NEXT)
}, 50L)
}
}
return@setOnEditorActionListener result
}
预期的行为是宣布错误,然后宣布下一个TextInputLayout: