如何实现Android中间ProgressBar可访问性 [英] How to implement android intermediate progressbar accessibility

查看:102
本文介绍了如何实现Android中间ProgressBar可访问性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想宣布android中间进度条上的加载文本.我想为加载中间进度条时在Android设备上使用对讲服务的残障人士输出类似的内容.

I would like to announce the loading text on an android intermediate progressbar. I want to output something like this for disabled people who are using talkback service on the Android device when an intermediate progressbar is loading.

  • 文件正在加载.
  • 文件正在提取.
  • 文件正在转换.
  • 文件已加载.

我检查了一下google,发现我可以使用:

I checked around google and found that I could use:

1)在进度栏视图上宣布为ForAccessibility.(在我的情况下不起作用,只有在使用Handler加载时才起作用)

1) announceForAccessibility on progressbar view. (Not working in my case, only works when I load it with a Handler)

我的代码

override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
    }

    override fun onResume() {
        super.onResume()
        val progressbar: ProgressBar = findViewById(R.id.testProgressBar)
        // progressbar.announceForAccessibility("My name is Neo "); // not working
        Handler().postDelayed(object : Runnable {
            override fun run() {
                progressbar.announceForAccessibility("My name is Neo ");
            }
        }, 1000)

    }

你们还有其他建议来解决这种问题吗?我想知道人们是如何在这么多地方工作的 https://www.programcreek.com/java-api-examples/?class=android.view.View&method=announceForAccessibility

Do you guys have any other suggestion to solve this kind of problem? I wonder how people got working at so many places https://www.programcreek.com/java-api-examples/?class=android.view.View&method=announceForAccessibility

感谢您的帮助.

推荐答案

您可以尝试礼貌的 android:accessibilityLiveRegion ,这将确保话语提示"不会打断已经宣布的内容:

You could try a polite android:accessibilityLiveRegion, which would ensure that TalkBack does not interrupt something already being announced:

<ProgressBar 
    android:id="@+id/testProgressBar"
    …
    android:accessibilityLiveRegion="polite" />

更多信息:使用实时区域

这篇关于如何实现Android中间ProgressBar可访问性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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