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

user1091368 picture user1091368 · Jan 2, 2012 · Viewed 33.6k times · Source

[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" />

Answer

sianis picture sianis · Jan 2, 2012

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.