Alex Rivera | Logout

Android Lint contentDescription warning

Asked 2011-12-14T06:55:37.220
136

I am getting warning as "[Accessibility] Missing contentDescription attribute on image" for imageview. while using android lint

What does that mean?

Edit
Report

2 Answers

53

Disabling Lint warnings will easily get you into trouble later on. You're better off just specifying contentDescription for all of your ImageViews. If you don't need a description, then just use:

android:contentDescription="@null"
answered 2013-07-11T21:12:06.827
41

Another option is to suppress the warning individually:

xmlns:tools="http://schemas.android.com/tools"  (usually inserted automatically)
tools:ignore="contentDescription"

Example:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent" 
    tools:ignore="contentDescription" >

       <ImageView
            android:layout_width="50dp"
            android:layout_height="match_parent"
            android:adjustViewBounds="true"
            android:padding="5dp"
            android:src="@drawable/icon" />
answered 2013-05-18T23:26:44.453

Your Answer