Search code examples
androidandroid-layoutandroid-lint

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?


Solution

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