In this chapter you focused on making your app more accessible to people using TalkBack. But this is not the whole story. Accommodating visual impairments is just one subset of accessibility.
Testing your application for accessibility should really involve user tests by people who actually use accessibility services on a regular basis. But even if this is not possible, you should still do your best to make your app accessible.
Google’s Accessibility Scanner analyzes apps and evaluates how accessible they are. It provides suggestions based on its findings. Try it out on CriminalIntent.
Begin by following the simple instructions at play.google.com/store/apps/details?id=com.google.android.apps.accessibility.auditor to install the app on your device.
Once you have Accessibility Scanner installed and running and you see the blue check mark icon hovering over your screen, the real fun can begin. Launch CriminalIntent from the app launcher screen or overview screen, leaving the check mark alone. Once CriminalIntent appears, make sure it is displaying the crime details screen (Figure 19.11).
Press the check mark, and the Accessibility Scanner will go to work. You will see a progress spinner while the analysis happens. Once the analysis is complete, a window showing suggestions will appear (Figure 19.12).
The ImageView, EditText, and CheckBox have outlines around them. This indicates that the scanner found potential accessibility problems with those widgets. Press on the EditText to view accessibility suggestions for that widget (Figure 19.13).
Accessibility Scanner has three suggestions.
The first relates to the size of the EditText.
The recommended minimum size for all touch targets is 48dp.
The EditText’s height is smaller, which
you can easily fix by specifying an android:minHeight
attribute for the widget.
The second issue relates to its label. The scanner points out that the information provided by the title TextView and the EditText may be redundant, since the EditText refers to the TextView. However, redundancy is not a problem here, so you can ignore this recommendation.
The final suggestion is about the contrast between the text color and its background color.
There are tools available online to estimate the contrast ratio of two colors based on their luminosity.
There are also sites, like randoma11y.com, that list color combinations that meet accessibility standards for contrast.
What are those standards?
The World Wide Web Consortium, an international community that develops open standards for web design, recommends a ratio of at least 4.5:1 for text that is 18 point or smaller.
The ratio of the colors in CriminalIntent’s EditText is 3.52.
To fix this, you can adjust the values of its android:textColor
and android:background
attributes.
You can learn more about each of Accessibility Scanner’s recommendations by pressing the down arrow to drill into the details and then pressing Learn More.