在android中录音期间暂停或停止对讲语音 [英] Pause or stop talkback voice during audio recording in android
问题描述
我在我的手机(galaxy S6)中启用了辅助功能,然后在点击一个按钮后尝试进行录音.这个按钮有一个带有长消息的 contentDescription 属性.问题是 Talkback 在语音消息录制过程中继续给出指示.我试图通过清空 contentDescription 或使用 setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO) 在录音时停止它,但他们都没有暂停对讲语音.有什么办法可以停止服用吗?
I have enabled accessibility in my phone(galaxy S6), then try to have a voice recording after clicking on a button. This button has a contentDescription attribute with a long message. The problem is Talkback continues to give directions during voice message recording. I tried to stop it while audio recording by making empty the contentDescription or using setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO), but none of them pause the talkback voice. Is there any way for stopping taking?
推荐答案
我不确定这是否是一个好的解决方案,但它对我有用:
I am not sure whether this is a good solution but it works for me:
public boolean onTouch(View v, MotionEvent event) {
int action = event.getAction();// & MotionEvent.ACTION_MASK;
if (action == MotionEvent.ACTION_DOWN) {
mChatAudioLabel.setText(getString(R.string.To_cancel_swipe_and_release));
AccessibilityManager manager = (AccessibilityManager) getSystemService(ACCESSIBILITY_SERVICE);
boolean isAccessibilityEnabled = manager.isEnabled();
if (isAccessibilityEnabled) {
AccessibilityEvent accessibilityEvent = AccessibilityEvent.obtain();
accessibilityEvent.setEventType(AccessibilityEvent.TYPE_ANNOUNCEMENT);
accessibilityEvent.setClassName(getClass().getName());
accessibilityEvent.getText().add("\u00A0");
manager.sendAccessibilityEvent(accessibilityEvent);
}
希望对大家有用
这篇关于在android中录音期间暂停或停止对讲语音的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!