为辅助功能语音反馈定义标签

时间:2014-07-16 11:51:05

标签: java android accessibility text-to-speech

我正在寻找如何从extern文件中进行texttospeech,例如从资源中进行。

通常它有用,它会读取视图的text / className / etc.

点击特定视图会很棒,例如只有图像的未命名按钮,以及来自带有映射字符串的资源的tts。

修改 是的,它适用于TalkBack,是的它会读取" Button",我想为它分配一个特定的字符串。 即使在xml布局中分配了文本,也要为特定按钮指定文本。

EG:

 <Button
     android:id="@+id/this_is_button"
     android:layout_height="wrap_content"
     android:layout_width="wrap_content"
     android:text="@string/self_destruct"
     android:onClick="selfDestruct" />

它将从android:text中读取内容。或者只是&#34; Button&#34;如果我们这里没有分配文字。

问题是如何为此按钮分配另一个可以阅读的文本。

1 个答案:

答案 0 :(得分:1)

请看一下这个网站:
http://developer.android.com/guide/topics/ui/accessibility/apps.html
它描述了如何使您在可访问性方面做得更好
标记用户界面元素部分应该对您很重要: http://developer.android.com/guide/topics/ui/accessibility/apps.html#label-ui

以下是如何标记ImageButton

的示例
<ImageButton
    android:id=”@+id/add_note_button”
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:src=”@drawable/add_note”
    android:contentDescription=”@string/add_note”/>

有关android的更多信息:contentDescription:http://developer.android.com/reference/android/view/View.html#attr_android:contentDescription
您可以在资源中设置任何字符串,以便可以按照与屏幕上显示的任何其他文本相同的方式对信息进行本地化 请注意,android:contentDescription即使在与文字相关联的视图上也能正常工作(然后会说出android:contentDescription