How do it disable message “double on tap” in view using talkback accessibility android?

百般思念 提交于 2021-02-05 07:35:44

问题


When a view has event click and enable talkback. I need to disable the audio "double to tap" in the view.

I am using accessibility in android development.

How can I do this, please?


回答1:


If you check google talkback source code at this line and here, string resource ("double tap") has been used here and here

So, you should remove AccessibilityActionCompat.ACTION_CLICK action and set isClickable to false in node info.

ViewCompat.setAccessibilityDelegate(view, object : AccessibilityDelegateCompat() {
        override fun onInitializeAccessibilityNodeInfo(host: View, info: AccessibilityNodeInfoCompat) {
            super.onInitializeAccessibilityNodeInfo(host, info)
            info.removeAction(AccessibilityNodeInfoCompat.AccessibilityActionCompat.ACTION_CLICK)
            info.isClickable = false
        }
    })

I tested this and it should work.




回答2:


Use

ViewCompat.setAccessibilityDelegate(view, new AccessibilityDelegateCompat() {
        @Override
        public void onInitializeAccessibilityNodeInfo(View host, AccessibilityNodeInfoCompat info) {
            super.onInitializeAccessibilityNodeInfo(host, info);
            info.addAction(AccessibilityNodeInfoCompat.ACTION_FOCUS);
        }
});

See more detail at https://stackoverflow.com/a/47875696/1915831



来源:https://stackoverflow.com/questions/40336288/how-do-it-disable-message-double-on-tap-in-view-using-talkback-accessibility-a

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!