8

In some devices (nexus) when we tap on the first item in listview it will talkback as list item + " in list of X item". How can we remove the text " in list of X item"?

Please share your thought

Thanks in Advance

Azeela
  • 213
  • 3
  • 8

2 Answers2

4

The way to control effectively how talkback behaves is to add content description on you views which should be described to the user:

Java

view.setContentDescription("Your text here");  

XML

android:contentDescription="Your text here"

and views that have no meaning to someone using talkback set :

JAVA

view.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO);

XML

android:importantForAccessibility="no"

There are several options:
auto
noHideDescendants
yes
no

Please note that you can control view groups that way also.
Play with it a little.

Mark Kazakov
  • 946
  • 12
  • 17
  • 1
    android:importantForAccessibility="no" really works well for recyclerview to avoid announcing item count at the end. – AndroDev Nov 11 '19 at 13:09
  • 3
    android:importantForAccessibility="no" will indeed change the accessibility announcement but it will also disable other accessibility features for the RecyclerView such as swipe navigation, etc... – Benoit Martin Feb 20 '20 at 17:14
3

I found a solution where you set weather the (RecyclerView or ListView) should be important for Accessibility directly.

If you set it to individual views items in the list, Talkback will still announce "x items" the first time that list gets created.

In Kotlin: "dataBinding.customRecyclerView.importantForAccessibility = View.IMPORTANT_FOR_ACCESSIBILITY_NO

JuJu Juned
  • 134
  • 8
  • True, the first time it still says In List / Out of List, but for rest of the items it does not say anything. Now with RecyclerView 1.2 also it will be the same behaviour without setting importantForAccessibility – Karan Sharma Jul 12 '21 at 12:55