Android的:如何扩大搜索栏时,消除了文字对白来自AccessibilityEvents? [英] Android: How to eliminate spoken text from AccessibilityEvents when extending SeekBar?

查看:262
本文介绍了Android的:如何扩大搜索栏时,消除了文字对白来自AccessibilityEvents?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的Andr​​oid应用程序包含根据搜索栏,我想自定义的文本短语附加到我的控制,以解释其用途的辅助功能。

我已经这样做了成功的使用 View.setContentDescription(文字)和话语提示正确地讲这句话的时候,我要求专注于我的滑块控件从 Activity.onCreate

到目前为止,一切都很好。然而,当我触摸控制,我相信设置AccessibilityFocus我的Andr​​oid API 16测试设备上,多余的话都被添加到口语词,即......寻求控制。 0%的。我想删除这些额外的话。

我曾尝试使用,以消除它们 event.getText()。明确的() View.onInitializeAccessibilityEvent(事件)没有成功。呼应事件LogCat中报告正确的短语 event.contentDescription event.text 没有条目,但额外话出现无论是在从设备硬件的音频输出和通过的菜单 - >设置 - > Accessibility-> TalkBack->设置 - >开发设置 - >显示语音输出显示在屏幕上的调试文本

请任何人都可以建议那些正在添加多余的话,以及如何消除它们?

任何有建设性的意见将受到欢迎。谢谢你。

更新

我可以看到一些触摸浏览(首次单头)在我的自定义控件事件没有经过任何的 onInitializeAccessibilityEvent dispatchPopulateAccessibilityEvent 方法,因为我特意打电话 event.setContentDescription(空)。尽管如此,有一个 AccessibilityEvent 正与我的自定义控件的 ContentDescription 设置活动产生.onCreate 在code,再加上多余的话我试图消除。

我还设置了 AccessibilityDelegate 在我的自定义控件的父的ViewGroup 来给予其<$ C知名度$ C> onRequestSendAccessibilityEvent 通话。这证实含有任何情况下,我的 ContentDescription 正在通过。

这是非常令人费解,而且发生在两个模拟器和真正的硬件API 16.任何想法?

解决方案

我认为这是对讲的错误,并已提出的谷歌眼中的免费问题#375 ,包括例如code。

My Android app contains a custom slider control based on the SeekBar, and I want to attach a custom text phrase to my control to explain its use for Accessibility.

I have done this successfully using View.setContentDescription(text), and TalkBack correctly speaks the phrase when I request focus on my slider control from Activity.onCreate.

So far, so good. However, when I touch the control, which I believe sets the AccessibilityFocus on my Android API 16 test device, extra words are being added to the spoken phrase, i.e. '...seek control. 0 per cent'. I want to remove these additional words.

I have tried to eliminate them using event.getText().clear() in View.onInitializeAccessibilityEvent(event) without success. Echoing the event to LogCat reports the correct phrase in event.contentDescription and no entries in event.text, but the extra words appear both in the audio output from the device hardware and in the on-screen debug text displayed by Menu->Settings->Accessibility->TalkBack->Settings->Developer Settings->Display Speech Output.

Please can anyone suggest where the extra words are being added, and how to eliminate them?

Any constructive suggestions would be welcomed. Thanks.

Update

I can see that some Explore By Touch (initial single-tap) event on my custom control does not pass through either its onInitializeAccessibilityEvent or dispatchPopulateAccessibilityEvent methods as I am deliberately calling event.setContentDescription(null). Despite this, there is an AccessibilityEvent being generated with my custom control's ContentDescription, set in Activity.onCreate in code, plus the extra words I'm trying to eliminate.

I've also set an AccessibilityDelegate on my custom control's parent ViewGroup to give visibility of its onRequestSendAccessibilityEvent calls. This confirms that no event containing my ContentDescription is passing through.

This is very puzzling, and happens on both the emulator and real hardware with API 16. Any ideas?

解决方案

I believe that this is a bug in TalkBack, and have raised Google Eyes-Free issue #375, including example code.

这篇关于Android的:如何扩大搜索栏时,消除了文字对白来自AccessibilityEvents?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆