19

I can not find an answer to what should be a very simple task. Can someone explain to me the best way to turn off accessibility (talkback) for an individual element in android?

I have a TextView that I programmatically set the contentDescription to nil, and it keeps talkback from saying the title, but when navigating through the view it still stops on that textview.. it just stays silent.

My goal is to have talkback completely ignore that the TextView exists.

Please help!

Thank you :)

edhnb
  • 2,122
  • 3
  • 24
  • 38
  • possible duplicate of [Android - prevent TalkBack from announcing TextView title aloud](http://stackoverflow.com/questions/15723797/android-prevent-talkback-from-announcing-textview-title-aloud) – rds Sep 23 '14 at 11:37

3 Answers3

52

In your XML file, set the importance to "no". You can also do this at run time using the View.setImportantForAccessibility() API.

<TextView
    android:importantForAccessibility="no"
    ... />
alanv
  • 23,966
  • 4
  • 93
  • 80
14

Programmatically you can say:

view.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO);
fedorqui
  • 275,237
  • 103
  • 548
  • 598
GokulaKrishnanM
  • 187
  • 1
  • 6
0

tools:ignore="TextSizeCheck"
this worked

  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community May 02 '23 at 20:16