'Android Accessability RecyclerView reading "in list X items"
So I am using RecyclerView for a page. When the user goes from outside the recyclerview to inside the recyclerview, talkback reads "in list X items" (x is number of items in list) at the end. Is there any way to stop it from doing this? One easy fix is marking it as not important for accessibility in XML but that means that accessibility does not scroll to all the items properly when part of the list is off screen.
Solution 1:[1]
As I understand adding collection information is done in RecyclerView's method
RecyclerView.LayoutManager :: onInitializeAccessibilityNodeInfo
method
try adding an accessibility delegate and resetting this information
recyclerView.setAccessibilityDelegateCompat(object : RecyclerViewAccessibilityDelegate(recyclerView) {
override fun onInitializeAccessibilityNodeInfo(
host: View,
info: AccessibilityNodeInfoCompat
) {
super.onInitializeAccessibilityNodeInfo(host, info)
info.setCollectionInfo(null)
}
})
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Mike |