Android TalkBack和片段堆栈 [英] Android TalkBack and fragment stack

查看:311
本文介绍了Android TalkBack和片段堆栈的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于我正在处理的应用程序,我需要实现可访问性。除了一个屏幕,我必须将片段添加到我的活动中之外,一切都正常。基本上,上面的片段是用于输入密码的拨号键盘。该片段添加有fragmentTransaction。

For an application that I work on, I need to implement accessibility. Everything works fine except for one screen where I have to fragments added to my activity. Basically, the fragment that is above is a dial keyboard to enter a passcode. This fragment is added with a fragmentTransaction.

问题是对讲焦点设置在下面片段的元素上。

The thing is that the talkback focus is set on the elements of the underneath fragment.

你知道吗是否有办法将对讲焦点设置在拨号片段上?我只想禁用下面的片段以获取焦点

Do you know if there is a way to set the talkback focus on the dial fragment ? I just want to "disable" the fragment underneath to get focus

谢谢,

推荐答案

UPDATE

我想出了解决方案。您可以在执行片段事务之前禁用第一个片段的可访问性。

I figured out the solution. you can disable the accessibility of the first fragment before you do the fragment transaction.

rootView = inflater.inflate(R.layout.first_fragment, null, false);

rootView.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS);

现在,您进行分段交易。第二个片段不会将焦点泄漏到第一个片段。

and now you commit your fragment transaction. Second fragment won't leak the focus to first fragment.

别忘了启用第一个片段的可访问性,以防您回到第一个片段。

Don't forget to enable the accessibility of first fragment in case you're coming back to the first fragment.

if(rootView != null) {
    rootView.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_YES);
}

这篇关于Android TalkBack和片段堆栈的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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