Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

imagebutton gives me error: [Accessibility] Missing contentDescription attribute on image

[Accessibility] Missing contentDescription attribute on image

What does this error mean and how can I fix it?

<ImageButton
    android:id="@+id/callbannerbuttonpg1"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_marginTop="157dp"
    android:background="@null"
    android:src="@drawable/callbanner"
    android:visibility="invisible" />
like image 586
user1091368 Avatar asked Jan 02 '12 13:01

user1091368


People also ask

What is contentDescription in ImageView?

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.

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

You can do this by adding the contentDescription attribute to your XML layout.

What is content description attribute in Android?

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 the content of the view. This property is used primarily for accessibility.


2 Answers

Designing for Accessibility

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

And this is not error just a warning. Usage of this attribute is optional.

like image 80
sianis Avatar answered Sep 22 '22 04:09

sianis


Add to the imageButton

android:contentDescription="@string/desc"
like image 32
Bhavik Kothari Avatar answered Sep 19 '22 04:09

Bhavik Kothari