Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the real purpose of Android's contentDescription tag?

Tags:

One of the latest updates for the Android SDK plugin in Eclipse introduced a lot of new warnings for your layouts and such. One of these is an accessibility warning that appears if you don't have the android:contentDescription tag set. This resulted in hundreds of warnings in one of my projects, and that naturally makes it a lot harder for me to find other more important warnings.

enter image description here

Looking at the official documentation, it seems that this tag is pretty useless from an end-user's perspective. Here's the description of it:

Defines text that briefly describes content of the view. This property is used primarily for accessibility. Since some views do not have textual representation this attribute can be used for providing such.

So basically, my question is what's the purpose of that tag? It only seems to be taking focus away from the "real" errors / warnings, and I don't really see how it can be an accessibility warning if it doesn't affect the user.

like image 934
Michell Bak Avatar asked Feb 11 '12 17:02

Michell Bak


People also ask

What does Android contentDescription do?

When using an ImageView , ImageButton , CheckBox , or other View that conveys information graphically, use an android:contentDescription attribute to provide a content label for that View . A content label sometimes depends on information only available at runtime, or the meaning of a View might change over time.

How do I set content description programmatically?

Fortunately, implementing content descriptions is simple. You can do this by adding the contentDescription attribute to your XML layout. It can also be done programmatically by calling the setContentDescription method in your Java file.

Which of the following attributes should you add to ImageView and ImageButton elements to enable screen readers to describe the image?

Non-textual widgets like ImageViews and ImageButtons should use the contentDescription attribute to specify a textual description of the widget such that screen readers and other accessibility tools can adequately describe the user interface.


1 Answers

For some disabled people that tag almost similar to the "alt" tag in HTML, therefore it IS useful to the end user. Effectively it will allow a textual description to be presented to the user of what they may not be able to see clearly/interact with.

From the Android docs:

Defines text that briefly describes content of the view. This property is used primarily for accessibility. Since some views do not have textual representation this attribute can be used for providing such.

EDIT: Ice Cream Sandwich accessibility features are described in this article http://www.ubergizmo.com/2011/11/android-ice-cream-sandwich-accessibility/

There is a mention in this Google article as part of Android 4.0 highlights http://developer.android.com/sdk/android-4.0-highlights.html#UserFeatures

like image 50
Graham Smith Avatar answered Oct 25 '22 09:10

Graham Smith