-1

Accessibility Missing contentDescription attribute on image

<ImageView
    android:id="@+id/imageView1"
    android:layout_width="34dp"
    android:layout_height="61dp"
    android:layout_marginLeft="11dp"
    android:layout_marginRight="0dp"
    android:layout_marginTop="11dp"
    android:background="#ff3333"
    android:src="@drawable/arrows" />
adneal
  • 30,484
  • 10
  • 122
  • 151
user3504795
  • 3
  • 1
  • 2
  • Duplicate of http://stackoverflow.com/questions/11304847/accessibility-missing-contentdescription-attribute-on-image-how-to-remove-this-w – cybersam Apr 09 '14 at 00:27

2 Answers2

3

You can use the layout editor's tools or set the android:contentDescription to null.

Here's an example:

// You don't need a FrameLayout, 
// tell the layout editor what to "ignore" in your layout's parent

<FrameLayout 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:id="@+id/imageView1"
        android:layout_width="34dp"
        android:layout_height="61dp"
        android:layout_marginLeft="11dp"
        android:layout_marginRight="0dp"
        android:layout_marginTop="11dp"
        android:background="#ff3333"
        android:src="@drawable/arrows" />

</FrameLayout>

<ImageView
    android:id="@+id/imageView1"
    android:layout_width="34dp"
    android:layout_height="61dp"
    android:layout_marginLeft="11dp"
    android:layout_marginRight="0dp"
    android:layout_marginTop="11dp"
    android:background="#ff3333"
    android:contentDescription="@null"
    android:src="@drawable/arrows" />

But even better you should consider adding a short String to accurately describe what the ImageView is for.

From the docs:

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.

Must be a string value, using '\;' to escape characters such as '\n' or '\uxxxx' for a unicode character.

adneal
  • 30,484
  • 10
  • 122
  • 151
0

Add following line in your xml imageView and it should go away.

 android:contentDescription:"@string/desc"
Dushyant Patel
  • 687
  • 8
  • 20