游戏邦在:
杂志专栏:
gamerboom.com订阅到鲜果订阅到抓虾google reader订阅到有道订阅到QQ邮箱订阅到帮看

盘点7种提高Android应用辅助功能的方法

发布时间:2011-06-14 15:30:15 Tags:,,,

作者:Lauren Darcey、Shane Conder

在手机应用设计中,可接入性时常为人所忽略。可接入性的含义是,设计的应用适用于所有用户,包括那些有特殊需求的人或残障人士。这类辅助功能渐渐也需要满足某些特别情况的用户需求,比如,现在交通安全法限制汽车驾驶员使用他们的设备。

随着手机平台日渐成熟,尽管可接入性功能已成为开发者SDK的部分内容,但它们很容易被新开发者忽略和遗忘。开发者们简单迅速地制作出应用,然后将其投放到Android Market上。这些开发者本可以在设计时将简单完善的辅助功能整合到应用中,他们失去了让应用表现差异化的良好机遇。辅助功能对用户和开发者都有所帮助,前者可能需要这些功能来使用应用,后者需要更多用户下载并使用他们的应用。

Android SDK中有许多功能为应用辅助性提供支持。除辅助功能基本包之外,还有些小辅助功能散布于普遍使用的SDK之中。在下文中,我们将分析Android SDK设计和构建具有高度辅助性应用的主要功能,以下这些方法使用难度递增。

android-apps(from cnet.com.au)

android-apps(from cnet.com.au)

1、View中的内容描述

提高应用辅助性最简单的方法是在用户界面的每个View控制中提供内容描述。这些信息可以为屏幕阅读器等辅助服务和工具所使用,帮助弱视用户使用应用用户界面。在XML中,该属性称为android:contentDescription,相关View类型方法为setContentDescription。比如,如果你在ImageView控制中有张大猩猩的图片,你可以设置内容来描述这张图片。同样,如果屏幕上有多个Button控制,你可以用简短的内容描述各个控制的作用进行区分。

2、Haptic反馈功能

正如Android SDK程序说明书中的形象描述,Haptic反馈指你点击设备触摸屏上的控制时感觉到的小震动。View控制有某些内置Haptic反馈功能。但是,你可以轻易撇开默认的震动行为,自行为其他事件设置Haptic反馈功能。控制可以有Haptic功能,也可以没有,事件由开发者来决定。查看View控制属性以及与Haptic反馈相关方法,了解更多细节。

3、Text-to-Speech服务

Text-to-Speech(游戏邦注:下文简称“TTS”)服务可识别文字数据,让设备以计算机的“声音”大声“读出”内容。导航应用等免持应用经常用这项技术来提示司机,弱视用户也可以用此类型的服务来理解屏幕上的文字。Android SDK中可用的TTS功能在android.speech.tts包中,可以非常容易地将TTS嵌入到应用中。

4、语音识别服务

简单地说,语音识别服务正好与TTS相反,识别用户输入的声音并将其转化成为文本数据。这项服务经常用于搜索应用和联系管理应用中,设备会对“Call Mom”等特定指令做出回应。Android SDK中可用的语音识别功能在android.speech包中,使用android.speech.RecognizerIntent方式就可以为应用添加这项服务。该方式可用来开启内置录音应用,将识别的文字结果反馈给你的应用。

5、替代性输入方式

某些Android设备有方向键、轨迹球或箭头键之类的方向控制器。弱视用户偏爱这些类型的设备,它们可以系统地导航用户选择屏幕上的各个组件。确保应用支持这些输入方式。必须特别关注获得用户关注的布局中View控制的命令。你可以在使用android:nextFocus*属性的布局中跳过View控制的关注命令。

6、如果使用传统Views,确保它们能够恰当传达辅助事件

Android平台上有着大量系统服务,确保平台能够稳定流畅地运行。辅助服务就是此类服务之一。当Button控制之类的内置View控制被点击后,它传达的辅助服务是“我已经被点击了!”。如果你使用传统的View控制,就有责任向辅助服务恰当传达事件。为实现这个目标,你的传统View控制必须使用AccessibilityEventSource界面,来传达AccessibilityEvent事件。

7、使用自己的辅助技术

如果你有自己的辅助技术,就需要连接至所有的辅助事件。这可以通过执行你自己的AccessibilityService来实现,AccessibilityEvent动作被触发后,Android Service会收到信息。这项服务可以接收各种不同的事件,对提供某些类型的辅助组件很有帮助。这些事件包括用户点击View、控制注意力发生改变或物体上的文字发生改变等。如果使用自己的控制,必须确保能施行同种类型的事件。

总结

Android SDK的辅助功能健全、占容量少而且易于使用,多数人都会选择。在设计时忽略应用的辅助性会限制你的潜在用户数量,疏远某些用户群体实非明智之举。应用支持辅助功能的程度与目标用户和项目目标有关。只需一些小更新,所有应用都可以有效改善它们的辅助性。(本文为游戏邦/gamerboom.com编译,如需转载请联系:游戏邦

Top 7 Android Accessibility Features

Lauren Darcey & Shane Conder

One often overlooked aspect of mobile application design is accessibility. That is, designing the application such that it functions well for all users, including those with special needs or disabilities. Increasingly, accessibility features are needed for specific user situations as well; for example, automobile drivers are now limited in their device usage by traffic safety laws.

As mobile platforms have matured, accessibility features have begun to appear as part of the developer SDKs, but they are easily overlooked or forgotten about by novice developers who simply rapid prototype their application and throw it up onto the Android Market. These developers are missing an exciting opportunity to differentiate their applications from others by integrating simple but robust accessibility features at design time. Doing so helps both the users (who may need these features to use the app) and the developer (who wants as many users downloading and using the app as possible).

The Android SDK includes many features to support accessibility. In addition to the primary accessibility packages, there are subtle accessibility features peppered throughout the commonly used classes of the SDK. Let’s look at some of the top features of the Android SDK designing and building highly accessible applications. These methods are discussed in order of difficulty from easy to more challenging.

#1: Use View Content Descriptions

One of the easiest ways to improve the accessibility of your application is to provide content descriptions to each of the View controls in your user interfaces. This information can be used by accessibility services and tools like screen readers to help visually-impaired users navigate your application user interfaces. In XML, the attribute is called android:contentDescription. The related View class method is setContentDescription. For example, if you had an ImageView control with a picture of a gorilla, you might set a content description string saying as much. Similarly, you can use content descriptions to differentiate between Button controls when more than one is displayed on the screen by providing a short description naming that Button control’s purpose.

#2: Leverage Haptic Feedback Features

As the Android SDK documentation so eloquently puts it: “BZZZTT!!1!” Haptic feedback is that little physical vibration you feel when you press controls on the touchscreen of the device. View controls have certain built-in haptic feedback features. However, you can override the default behavior easily to provide your own haptic feedback features for other events. Haptic features for a given control can be enabled or disabled, and events can be generated by the developer. See the View control attributes and methods associated with haptic feedback for details.

#3: Leverage Text-to-Speech Services

Text-to-speech (TTS) services take textual data and have the device “read” the content aloud using a computer “voice.” Hands-free applications, such as navigation apps routinely use this technology to provide turn-by-turn directions to automobile drivers, while the visually impaired can also use this type of service to help decipher text on the screen. The TTS features available with the Android SDK are found in the android.speech.tts package and are very easy to incorporate into your applications with the TextToSpeech class (android.speech.tss.TextToSpeech).

#4: Leverage Speech Recognition Services

Simply text-to-speech in reverse, speech recognition services take voice input from the user and turn it into textual data. You’ll frequently see this service used by search applications and contact management applications that respond to specific commands like “Call Mom.” The speech recognition features available with the Android SDK are found in the android.speech package and are very easy to incorporate into your applications with the android.speech.RecognizerIntent intent. This intent can be used to launch the built-in speech recorder and retrieve the resulting text to your application.

#5: Support Alternative Input Methods

Some Android devices have directional controllers like directional-pads, trackballs, and arrow keys. These types of devices are often favored by those with visual impairments, as they allow the user to systematically navigate a screen of components. Ensure your applications provide support for these input methods as well as simple touchscreens. Special attention must be given to the order in which View controls within a layout gain focus. You can override the focus order of View controls within a layout using the android:nextFocus* attributes.

#6: Implementing Custom Views? Make Sure They Send Appropriate Accessibility Events

There are a number of system services operating on the Android platform to keep it running smoothly. One such service is the accessibility service. When a built-in View control like a Button control is clicked, it tells the accessibility service “I’ve been clicked!” When you implement custom View controls, it is your responsibility to send appropriate events to the accessibility service. To do this, your custom View control must implement the AccessibilityEventSource interface (android.view.Accessibility.AccessibilityEventSource) and fire off AccessibilityEvent events (android.view.Accessibility.AccessibilityEvent).

#7: Using Your Own Accessibility Technology?

If you have your own accessibility technology, you’ll want to hook into accessibility events. This can be done by implementing your own AccessibilityService (android.accessibilityservice.AccessibilityService), an Android Service class that receives calls when AccessibilityEvent actions are triggered. This service receives calls for a variety of different events useful in providing some sort of accessibility augmentation. Some of these events include the user clicking on a View object, changing focus on an control, or the text on an object changing–the same sorts of events you must make sure to implement when making your own controls.

Conclusion

The accessibility features of the Android SDK are robust, lightweight and easy to use; there’s little reason not to use them. Not considering accessibility at application design time limits your potential user base and alienates certain groups of users needlessly. The depth to which your specific application supports accessibility features depends on the intended audience and specific project goals. However, all applications can greatly improve their accessibility with just a few simple updates. (Source: Developer)


上一篇:

下一篇: