[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" />
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.
You can do this by adding the contentDescription attribute to your XML layout.
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.
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.
Add to the imageButton
android:contentDescription="@string/desc"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With