Google Android team recently published some new resources to help developers make their Android applications more accessible.
"Accessibility is about making sure that Android users who have limited vision or other physical impairments can use your application just as well as all those folks in line at the supermarket checking email on their phones," the team writes. "When it comes down to it, making an application accessible is about having a deep commitment to usability, getting the details right and delighting your users. It also means stepping into new territory and getting a different perspective on your application," the team adds.
How to Make Your Application Accessible
- "Task flows: Design well-defined, clear task flows with minimal navigation steps, especially for major user tasks, and make sure those tasks are navigable via focus controls.
- Action target size: Make sure buttons and selectable areas are of sufficient size for users to easily touch them, especially for critical actions. How big? Google recommend that touch targets be 48dp (roughly 9mm) or larger.
- Label user interface controls:Label user interface components that do not have visible text, especially ImageButton, ImageView, and EditText components. Use the android:contentDescription XML layout attribute or setContentDescription() to provide this information for accessibility services.
- Enable focus-based navigation: Make sure users can navigate your screen layouts using hardware-based or software directional controls (D-pads, trackballs and keyboards). In a few cases, you may need to make UI components focusable or change the focus order to be more logical.
- Use framework-provided controls: Use Android's built-in user interface controls whenever possible, as these components provide accessibility support by default.
- Custom view controls: If you build custom interface controls for your application, implement accessibility interfaces for your custom views and provide text labels for the controls.
- Test: Checking off the items on this list doesn't guarantee your app is accessible. Test accessibility by attempting to navigate your application using directional controls, and also try eyes free navigation with the TalkBack service enabled," explains Google.
Here’s an example of implementing some basic accessibility features for an ImageButton inside an XML layout - note the "content description that accessibility services can use to provide an audible explanation of the button. Users can navigate to this button and activate it with directional controls, because ImageButton objects are focusable by default (so you don't have to include the android:focusable="true" attribute)," the team explains:
<imagebutton android:id="@+id/add_note_button" android:src="@drawable/add_note_image" android:contentdescription="@string/add_note_description"/>
The resources include: