Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Lint contentDescription warning

I am getting warning as "[Accessibility] Missing contentDescription attribute on image" for imageview. while using android lint

What does that mean?

like image 685
MGK Avatar asked Dec 14 '11 06:12

MGK


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.

What is content description in ImageView?

The content description attribute links a text description to a control, ImageView, or other focusable object that otherwise has no text content. These objects wouldn't be accessible without some some sort of label or description.

Which XML attribute should be used to make an image view accessible?

Like ALT in Websites, in Android you can use contentDescription attribute in your ImageViews. This property is used primarily for accessibility.

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

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

Resolved this warning by setting attribute android:contentDescription for my ImageView

android:contentDescription="@string/desc" 

Android Lint support in ADT 16 throws this warning to ensure that image widgets provide a contentDescription.

This 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.

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.

like image 61
MGK Avatar answered Oct 01 '22 19:10

MGK