Android accessibility in Edit text box text not reading properly/Expect After Talk back on

拟墨画扇 提交于 2019-12-11 17:39:52

问题


I am creating app for blind people. there, when blind people after entered the zip code on that profile registration Edit Text box, like 45987. It reading as Fourty Five Thousand and Nine hundred eighty seven.

But, I want to read an Four Five Nine Eight Seven. 4 5 9 8 7.

Note: when i tried for the same in TexView, its reading as correctly. only problem with EditText.

My Sample Code: zipCode_EditText.setContentDescription("4 5 9 8 7");

I have referred these link:

Android Acccessibility: How do I change the text read out loud for an EditText View

How to make TalkBack read TextView error message automatically?

Thanks Advance


回答1:


In general, you don't want to force a screen reader to read something a specific way. Unfortunately, screen reader users are used to the way things are read. If your input field has a properly associated label with it, such as "zipcode", then when they hear "zipcode Fourty Five Thousand and Nine hundred eighty seven", they will understand what it is. Screen reader users can navigate elements by character so they can read each number separately if they want.

The important part is that you have a label associated with the input field. I know you're writing specifically for Android (which I'm not familiar with), but if I compare what you're doing to html, in html you'd want something like:

<label for="zip">zipcode:</label>
<input id="zip">

There are ways (in html) to force what a screen reader says, but it typically messes things up for braille users. Any "hidden" text you add to force the screen reader speech is physically displayed on braille devices.

For html, the autocomplete attribute can be used as a "hint" to screen readers on the type of information that is in a field. Screen reading software can use that hint to change the way it reads the contents of the field (such as autocomplete="postal-code"), but support for this hint is not widely supported yet. Again, I know that's for html and you're writing specifically for android, but perhaps there's a similar "hint" concept for android.




回答2:


It is best to not force Talk Back to do this. My recommendation would actually be to just stop doing this altogether. As a blind person it is actually easier to parse a single number than individual ones. 45,500 is easier to remember than 4, 5, 5, 0, 0. Covering "forty-five thousand nine-hundred eighty-seven" mentally to a zip code becomes second nature. And if there's a number long enough such that it requires inspection one number at a time, TalkBack has modes to support that. You can switch TalkBack to character mode and explore it like that manually.

This requirement really just comes from sighted individuals thinking like a sighted individuals and solving problems blind individuals don't have.

And since another user brought it up, the best way to code an edit text in Android is

TextView label = ....
EditText editBox = .....

label.setLabeFor(editBox);


来源:https://stackoverflow.com/questions/52215042/android-accessibility-in-edit-text-box-text-not-reading-properly-expect-after-ta

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!