Many
user interface controls depend on visual cues to indicate their meaning
and usage. For example, a note-taking application might use an
ImageButton with a picture of a plus sign to indicate that the user can add a new note. An EditText
component may have a label near it that indicates its purpose. A user
with impaired vision can't see these cues well enough to follow them,
which makes them useless.
You can make these controls more accessible with the
android:contentDescription
XML layout attribute. The text in this attribute does not appear on
screen, but if the user enables accessibility services that provide
audible prompts, then when the user navigates to that control, the text
is spoken.
For this reason, set the
android:contentDescription attribute for every ImageButton, ImageView, CheckBox
in your application's user interface, and add descriptions to any other
input controls that might require additional information for users who
are not able to see it.
For example, the following
ImageButton sets the content description for the plus button to the add_note string resource, which could be defined as “Add note" for an English language interface:<ImageButton android:id=”@+id/add_note_button” android:src=”@drawable/add_note” android:contentDescription=”@string/add_note”/>
By
including the description, an accessibility service that provides
spoken feedback can announce "Add note" when a user moves focus to this
button or hovers over it.
No comments:
Post a Comment