Say I have a list of items, and one of the views in each item is a message, in a simple TextView, that is populated in code (dynamic data from a backend service).
<TextView
android:id="@+id/message"
style="@style/DefaultText"
/>
Visually it doesn't need a label; the list item layout is pretty clear. But listening to how TalkBack reads the screen, I think it would be beneficial to have a "label" or description for it. So that TalkBack would read something like:
Message: [the actual dynamic message content]
My question is: is it possible to add a label/description for a TextView that, firstly, does not replace the TextView content, but is read along with it, and secondly, only affects TalkBack (not the visual presentation)?
What I tried:
contentDescription
for the TextView. Doesn't work: if set, the actual content is not announced, only thecontentDescription
. Hmm, maybe if I'd set this in code with the description prepended to the actual content... but is there no easier way?- Separate TextView with
labelFor
pointing to@+id/message
. The problem is that it's also shown visually and screws up the design. If I make it not visible, one way or other, it seems TalkBack won't read it either.