简体   繁体   English

TextView的Android辅助功能

[英]Android accessibility feature for TextView

Hi I have a view with a TextView and linear layout. 嗨,我有一个TextView和线性布局的视图。 Linear layout is a kind of custom keyboard with number of buttons. 线性布局是一种具有多个按钮的自定义键盘。 So every button click I have to do some validations and append a character to the TextView. 所以每按一次按钮我都要做一些验证并在TextView上添加一个字符。

Click of each button I append the character to the textview. 单击每个按钮我将角色附加到textview。 Now when I turn the Accessibility feature ON, it is expected to read out the last character that is entered. 现在,当我打开辅助功能时,预计会读出输入的最后一个字符。 But what happens is every time I set text in the text view.. Accesibilty feature reads out the 1st char in the textview, not the last char.. so Im confused on how to control the accessiblity of textview.. Can anyone plz tell me how to control the accessibilty. 但是每次我在文本视图中设置文本时会发生什么.. Accesibilty功能读取textview中的第一个字符,而不是最后一个字符..所以我很困惑如何控制textview的accessiblity ..任何人都可以告诉我如何控制accessibilty。

You could use the setContentDescription() on your TextView to set it to the character you just entered. 您可以使用TextView上的setContentDescription()将其设置为刚刚输入的字符。 Then when accessibility kicks in it will ask your TextView for its content description and it should work. 然后,当可访问性启动时,它将询问TextView的内容描述,它应该工作。 See docs here: 请参阅此处的文档:

https://developer.android.com/reference/android/view/View.html#setContentDescription(java.lang.CharSequence) https://developer.android.com/reference/android/view/View.html#setContentDescription(java.lang.CharSequence)

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

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