googlearchive/android-BasicAccessibility

Give TalkBack focus to a RecyclerView

Artenes opened this issue · 1 comments

I have the following xml (some attributes were omitted for simplicity):

<FrameLayout>

  <RecyclerView 
       android:id="@+id/list"
       android:focusable="true"
       android:contentDescription="Some content"/>

</FrameLayout>

When I activate TalkBack (TTS) to test accessibility in my app, I want to be able to click in the RecyclerView (in any item on it) so the whole RecyclerView gets focused and its content description gets read.

I've tryed:

  • removed any android:focusable="true" from the items in the list, alsto there is no TextView in them, so TTS cannot read them.
  • added android:focusable="true" to the RecyclerView. Even by making the view larger than its children and being able to click directly on it, it was not receiving any focus at all.
  • was able to "focus" on the RecyclerView by wrapping it with a FrameLayout and adding android:focusable="true" to it, so the FrameLayout was being focused giving the impression the whole list was focused (but this is more of a workaround).

Is even possible to give accessibility focus to a RecyclerView? As far as I understood from the samples is that to focus on a ViewGroup you just got to add the android:focusable=true to it.

This sample has been deprecated/archived (check README for more information on newer samples related to this technology).

As recommended by GitHub, we are closing all issues and pull requests.