I have been trying to implement ViewPager2 with accessibility with talk-back but focus is not moving beyond the second partial visible item. I want to traverse and scroll the viewpager2 with talkback and accessibility but was not able to achieve that.
--------------
| <item> | <item> | <item> | <item> | <item> |
--------------
Please Help me in this. I have searched a lot tried various things but nothing has worked for me.
ViewPager2.accessibilityDelegate = object : AccessibilityDelegate() {
override fun onRequestSendAccessibilityEvent(
host: ViewGroup?,
child: View?,
event: AccessibilityEvent?
): Boolean {
if (event?.eventType == AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUSED) {
ViewPager2.currentItem = ViewPager2.indexOfChild(child)
}
return super.onRequestSendAccessibilityEvent(host, child, event)
}
}