Android 工具栏内容说明';I don’我没有按预期工作
我正在将Android 工具栏内容说明';I don’我没有按预期工作,android,accessibility,talkback,android-accessibility,Android,Accessibility,Talkback,Android Accessibility,我正在将contentDescription设置为Fragment和DialogFragment类中的工具栏 在Fragment类中,它工作正常。 (例如 在以工具栏为中心的工具栏上,“toolbarContentDescription” 下一次向前滑动时,“向上导航” 下次向后滑动时,“工具栏内容描述”) 在DialogFragment类中,它首先读取导航。 (例如 在以工具栏为中心的“导航工具栏内容说明” 下一次向前滑动时,“向上导航” 下次向后滑动时,“toolbarContentDesc
contentDescription
设置为Fragment和DialogFragment类中的工具栏
在Fragment
类中,它工作正常。
(例如
“toolbarContentDescription”
“向上导航”
DialogFragment
类中,它首先读取导航。
(例如
“向上导航”
“toolbarContentDescription”
)navigationContentDescription
的位置来修复它。但它在dialogFragment类中不起作用。如果我删除navigationContentDescription,在后面的箭头上会显示“Unlabeled Botton”
我不明白这种不同行为的原因。它应该与对话框片段中的片段类读取相同的工具栏描述。
TalkBack
对对话框屏幕有特殊处理。在每个对话框中,屏幕阅读器都会特别宣布其标题。我认为您无法改变这种行为,因为它不在您的应用程序范围内,而是在TalkBack
实现本身中
fun setToolBar(toolbar: Toolbar, title: String) {
getMainActivity().setSupportActionBar(toolbar)
toolbar.title = title
toolbar.contentDescription = "toolbar content description here"
toolbar.setTitleTextAppearance(context, R.style.white_toolbar_text)
toolbar.setBackgroundColor(ContextCompat.getColor(context, R.color.white))
toolbar.setNavigationIcon(R.drawable.ic_back_arrow)
// set back arrow content description.
toolbar.navigationContentDescription = "Navigation Up"
toolbar.setNavigationOnClickListener {
getMainActivity().onBackPressed()
}
toolbar.requestFocus()
toolbar.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_FOCUSED)
}