Accessibility Callback - 当 talkback 读完通知时

Accessibility Callback - when talkback finish reading announcement

在某些用户操作中,我想在屏幕上显示一些 announcement,不久之后,我想将辅助功能焦点转移到 specifc view

我可以做到,

 view!!.announceForAccessibility("some action failed.")
  Handler().postDelayed({
         specificView.requestFocus() 
    specificView.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_FOCUSED)
   }, 1000)

但这只是一种解决方法。在某些情况下,当用户有 customized speaking rate

时,它可能会失败

Is there any way where we can get a callback when talkback finish with reading announcement?

我不确定它是否是正确的解决方案,但这对我有用。

 specificView.contentDescriotion = "text you need to annonce"
 specificView.requestFocus()
 specificView.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_FOCUSED)
 Handler().postDelayed({
     specificView.contentDescriotion = "actual content description for that view"
 }, 300)

为您要关注的视图的内容描述发布公告。