Android apps should aim to be usable by everyone, including people with accessibility needs.
People with impaired vision, color blindness, impaired hearing, impaired dexterity, cognitive disabilities, and many other disabilities use Android devices to complete tasks in their day-to-day lives. When you develop apps with accessibility in mind, you make the user experience better, particularly for users with these and other accessibility needs.
This document presents guidelines for implementing key elements of accessibility so that everyone can use your app more easily. For more in-depth guidance on how to make your app more accessible, visit the principles for improving app accessibility page.
Increase text visibility
For each set of text within your app, the color contrast – or difference in perceived brightness between the color of the text and the color of the background behind the text – is recommended to be above a specific threshold. The exact threshold depends on the text's font size and whether the text appears in bold:
- If the text is smaller than 18pt, or if the text is bold and smaller than 14pt, the color contrast ratio should be at least 4.5:1.
- For all other text, the color contrast ratio should be at least 3.0:1.
The following image shows two examples of text-to-background color contrast:
To check the text-to-background color contrast in your app, use an online color contrast checker or the Accessibility Scanner app.
Use large, simple controls
Your app's UI is easier to use if it contains controls that are easier to see and tap. We recommend that each interactive UI element have a focusable area, or touch target size, of at least 48dp ✕ 48dp. Larger is even better.
For a given UI element to have a large enough touch target size, the following conditions should both be true:
- The sum of the values of
android:paddingRightis greater than or equal to 48dp.
- The sum of the values of
android:paddingBottomis greater than or equal to 48dp.
The padding values allow an object's visible size to be less than 48dp ✕ 48dp while still having the recommended touch target size.
The following code snippet shows an element that has the recommended touch target size:
<ImageButton ... android:paddingLeft="4dp" android:minWidth="40dp" android:paddingRight="4dp" android:paddingTop="8dp" android:minHeight="32dp" android:paddingBottom="8dp" />
Describe each UI element
We recommend that each UI element in your app includes a description that
describes the element's purpose. In most cases, you include this description in
contentDescription attribute, as shown in the following code
<!-- Use string resources for easier localization. --> <!-- The en-US value for the following string is "Inspect". --> <ImageView ... android:contentDescription="@string/inspect" />
When adding descriptions to your app's UI elements, keep the following best practices in mind:
Don't include the type of UI element in the content description. Screen readers automatically announce both the element's description and type.
For example, if selecting a button causes a "submit" action to occur in your app, the button's description should be
Each description should be unique. That way, when screen reader users encounter a repeated element description, they correctly recognize that the focus is now on an element that has already had focus earlier.
In particular, each item within a view group such as
RecyclerViewshould have a different description. Each description should reflect the content that's unique to a given item, such as the name of a city in a list of locations.
If your UI includes graphical elements that are used for decorative effect only, set their descriptions to
"@null". If your app's
16or higher, you can instead set these graphical elements'
To learn more about making your app more accessible, see the following additional resources:
- Android BasicAccessibility Sample, available on GitHub, is a sample app containing a variety of UI elements. It demonstrates how to add accessibility markup to each of these elements and how accessibility services respond to this markup.