Search code examples
androidkotlinaccessibilitytalkback

How to use a description with Android TextView for Accessibility


I am wondering why Android doesn't support this.

To explain my problem. I am working on an accessibility feature for an Android app.

I have a TextView that displays a number value like 123456.

If I use TalkBack, it will always read just this number value.

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".

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.


Solution

  • The solution I did was to use

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