android - RecyclerView 中延迟加载子项的 RecyclerView 可访问性遍历
问题描述
我们可以用项目填充 a RecyclerView
,并且在绑定时,我们可以将其中一些项目标记为“标题”以方便访问。
这意味着在 TalkBack 的“标题”遍历模式下,用户可以直接在它们之间导航。
但是,aRecyclerView
在滚动时显然会绑定和取消绑定子项。在任何时候,可能只有总标题项的一小部分加载到视图持有者中。仅在这些项目之间进行遍历是无益且令人困惑的。
有没有办法,甚至是最佳实践,来提供RecyclerView
我们同时满足(a)性能视图回收和(b)有意义的遍历整个内容集的可访问性?
解决方案
Not all of the items considered headings in your source data set will be visibly present in the RecyclerView
at any one time, just those in the current subset of the data presented by the RecycleView.Adapter
. Without being visible on screen, accessibility services like TalkBack don't have access to those other headings and therefore will not interact with them.
Technically, you could look at setting up custom handling of the accessibility tree, but this would need to handle all accessibility info for the view, not just the headings, and would likely impact performance especially for large data sets. There is no way to override the heading handling alone.
The behaviour your describe is default and expected behaviour on Android, even if it doesn't seem ideal from a screen reader user experience perspective.
推荐阅读
- excel - VBA:如何使用 for 和 if 循环改进代码
- python - (Selenium) iTunes 连接登录后,我得到了 driver.page_source 的意外结果
- c - 从标准输入中获取值并将其存储在链表节点中
- docker - Docker swarm相同的图像不同的构建
- excel - 如何告诉我的 RPA(Blue Prism)这个宏(MS Excel)已经完成并进一步处理另一个宏?
- angular - 从组件标签中获取子元素
- aframe - Aframe 网格旋转和动画
- android - 无法在改造的错误正文中获得错误响应
- multithreading - Sleeping Threadpool:工作线程在没有来自主线程的 notify() 的情况下唤醒
- python - django 将图像上传到 S3,(在 localhost 上工作,但在服务器上出现访问被拒绝错误)