Android Recyclerview Talkback issue

10,908

Solution 1

It would appear that at some point in the construction process your Recycler View is marked as importantForAccessibility. When a container view is marked as important for accessibility it gathers all of the information within that container and announces it as the content description.

This should remedy the situation.

android:importantForAccessibility="no" //Or "auto"

If at no point in code did you set this otherwise, this would appear to be a bug with your flavor of Android. This is certainly not desirable default behavior.

Edit:

Changed "no" to "auto". Really we just want it to not be "yes", which is the value that creates the poor behavior. Auto behaves better with Switch Control on modern devices.

Been investigating this on and off for a bit, I don't think there's a Android OS Version agnostic solution here. Android APIs have changed their definition of Focusability vs Accessibility Focusability too many times across too many versions.

Solution 2

Contrary to ChrisCM's answer, you should NOT set...

android:importantForAccessibility="no"

... on your RecyclerView. This will disable all native accessibility functionality related to your list, including the ACTION_SCROLL_FORWARD / ACTION_SCROLL_BACKWARD actions (Accessibility Source), and the ability to append "In List" / "Out of List" context to accessibility announcements.

Instead, you should set...

android:focusable="true"
android:focusableInTouchMode="true"

...on the root layout of your List items, which will enable them to gain focus individually when the accessibility user navigates to them.

Share:
10,908
akash89
Author by

akash89

I am an Android Developer.

Updated on July 24, 2022

Comments

  • akash89
    akash89 almost 2 years

    I have an Android Recyclerview which has some more rows of item.

    In the sense Recyclerview comprises of
    Row 1 ->> TextView , below that one more textview

    Row 2 ->> TextView , below that one more textview

    Issue is that, whenever I turn on the Talkback, it reads out the entire Recyclerview in one go, which is not expected, it should read one item at a time depending on the focussed item.

    Expected behavior is - Read component on Focus when d-pad is moved onto it.

    Any help??

  • ChrisCM
    ChrisCM almost 8 years
    That's interesting, I just tested your claim, and I'm scrolling around using talkback just fine! Also "focusable" and "focusableInTouchMode" have absolutely nothing to do with how the devices behaves when TalkBack is on. It makes very little sense to have a TextView receive focus, given the definition of focus in this context.
  • fanky10
    fanky10 over 7 years
    you could add the fact that this should be placed in each element (except for buttons) that you want to the talkback to find when navigating inside a recyclerview (yes, it works in RecyclerView as well)
  • Saurabh
    Saurabh over 4 years
    This works better than setting android:importantForAccessibility to no. As @AlgoRyan pointed out, it does disable native accessibility scrolling
  • vivek.kartha
    vivek.kartha almost 4 years
    Is there a bug report with Google on this?