Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Accessibility Missing contentDescription attribute on image how to remove this warning?

Tags:

android

Accessibility] Missing contentDescription attribute on image

 <ImageView
            android:id="@+id/imageView1"
            android:layout_width="34dp"
            android:layout_height="61dp"
            android:layout_marginLeft="11dp"
            android:layout_marginRight="0dp"
            android:layout_marginTop="11dp"
            android:background="#ff3333"
            android:src="@drawable/arrows" />
like image 534
Salman Amjad Avatar asked Jul 03 '12 05:07

Salman Amjad


Video Answer


2 Answers

In Eclipse

Window->prefrences->Android->Lint Error Checking->Issues-> Accessibility->Content Decription->Severty select Ignore.

OR

add android:contentDescription in ImageView.

  • See here For More About Lint Error Checking
like image 185
Samir Mangroliya Avatar answered Sep 16 '22 15:09

Samir Mangroliya


Lint support in ADT 16 and above throws this warning

Now question is why this is needed.

Consider scenario where you have designed application which have ImageView with some image.The image carries message what it does.But there may be a blind person who can not see.So in that case if you have used contentDescription attribute then Text-To-Speech functionality will read the value so even blind person will come to for what purpose image is placed there even though he can't see it.

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

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

like image 36
Vipul Avatar answered Sep 19 '22 15:09

Vipul