简体   繁体   English

如何将描述与 Android TextView 一起用于可访问性

[英]How to use a description with Android TextView for Accessibility

I am wondering why Android doesn't support this.我想知道为什么 Android 不支持这个。

To explain my problem.来解释我的问题。 I am working on an accessibility feature for an Android app.我正在为 Android 应用程序开发辅助功能。

I have a TextView that displays a number value like 123456.我有一个 TextView,它显示一个像 123456 这样的数值。

If I use TalkBack, it will always read just this number value.如果我使用 TalkBack,它总是会读取这个数值。

What I want it to give this value a context so that TalkBack would read something like: "Number value 123456" I am not able to do that as contentDescription just overrides the text value and hint attribute is read after the value like: "123456 Number value".我希望它给这个值一个上下文,以便 TalkBack 会读到类似:“数字值 123456”我不能这样做,因为 contentDescription 只是覆盖文本值,并且在值之后读取提示属性,例如:“123456 数字价值”。

Is there an alternative for this?有替代方案吗? Let me also say that the app is not using a separate TextView which would say "Number value" that TalkBack could read.我还要说,该应用程序没有使用单独的 TextView,它会显示 TalkBack 可以读取的“数值”。

The solution I did was to use我所做的解决方案是使用

var number = 123456
textView.contentDescription = "Number value ${number}"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM