Search code examples
androidtalkback

onTouchEvent is not called when talkback enabled on custom view


I'm implementing custom keyboard (through custom view) for password field and trying add accessibility feature, so when user single press on view it should pronounce selected value.

In my custom keyboard I need coordinates from MotionEvent so view can calculate on what draw (value) it was pressed.

But in this case when Talkback enabled onTouchEvent method is not called. It calls only when user double tap on view. Im trying to add custom OnTouchListener but it does not work. setFocusable=true and setFocusableInTouchMode=true.


Solution

  • When TalkBack is enabled a double tap is the equivalent of a single tap. That is, onTouchEvent will only be called when the user double taps a view/widget.