Android Acessibility API contentDescription

时间:2012-03-13 09:22:54

标签: android accessibility

您好我一直在努力学习如何添加一些辅助功能工具,但它似乎既不适用于三星Galaxy s2也不适用于仿真器。我创建了一个简单的活动,这是一个布局:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
   android:layout_width="fill_parent"
   android:layout_height="fill_parent"
   android:orientation="vertical" >

   <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/hello"
        android:contentDescription="Title" 
        android:focusable="true"/>

    <Button
        android:id="@+id/button1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Button" 
        android:contentDescription="Button to click"
        android:focusable="true"/>

    <ImageView
        android:id="@+id/imageView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/ic_launcher"
        android:contentDescription="Small image"
        android:focusable="true"/>
</LinearLayout>

我的应用程序设置为最低级别1.6和目标4.0我已经添加了android suppport库。 不幸的是,当我尝试“触摸”或选择这些项目时,我听不到描述。当然我已经激活了可访问性和TalkBack应用程序,但我这里唯一的事情是“屏幕关闭,音量x%”....还有什么我必须要做的吗?感谢

2 个答案:

答案 0 :(得分:6)

Honeycomb及以下的辅助功能需要使用轨迹球或方向键,或者提供虚拟D-Pad的无眼键盘,可在Play商店使用。语音反馈还需要一个有效的文本到语音引擎,因此请确保您的设备已安装语音数据。

你可以在这里找到Eyes-Free键盘: https://play.google.com/store/apps/details?id=com.googlecode.eyesfree.inputmethod.latin

当开启TalkBack并且TTS工作正常时,按下D-Pad箭头将在项目之间移动焦点,然后大声读取它们(或任何内容描述)。

冰淇淋三明治及其上方有一个“触摸式探索”功能,用户只需触摸屏幕即可听到反馈,不需要方向控制器。

作为旁注:已有文本的视图(如TextView和Buttons)通常不需要内容描述。纯粹装饰的图像应该有空的内容描述,可以使用android:contentDescription =“@ null”设置。

答案 1 :(得分:0)

你必须在姜饼上扔掉辅助功能事件才能回复你的触摸事件。 ICS工作得很好,它会为你抛出事件,但它不会在姜饼中做到这一点。