I am trying to get Talkback to read back a content descriptor on a button subclass. Once the button subclass is selected, Talkback gives me the content descriptor plus the word "button" at the very end. How do I prevent the extra word from being appended?
Note: I did some doc reading and noticed that dispathPopulateAccessibilityEvent() mentions getting an AccessibilityEvent populated/visiting children of the view that acted as the event trigger. Does this mean that the event always touches the view hierarchy?, and if so, is it the button superclass that is adding the text?
A simple workaround is to avoid using Button
, which causes the extra words to be added.
For example, you may be able to replace it with a TextView
, made to look like a button, and add a click listener using View.setOnClickListener(listener)
to get the desired effect - see Android docs.
There are a number of such listeners in the basic View
class which can be added to your UI component using View.setOn<Event>Listener(listener)
in your Activity.onCreate
method. In your case, a double-tap listener could be constructed with an onTouchListener
, though it may require a little experimentation to get the precise result you want.