Accessibility Missing contentDescription attribute on image how to remove this warning?

前端 未结 5 1112
鱼传尺愫
鱼传尺愫 2020-12-30 02:21

Accessibility] Missing contentDescription attribute on image

 

        
相关标签:
5条回答
  • 2020-12-30 02:58

    Type in ImageView

    android:contentDescription="TODO"
    
    0 讨论(0)
  • 2020-12-30 03:04

    try by adding android:contentDescription for ImageView

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

    for more info see

    http://android-developers.blogspot.in/2012/04/accessibility-are-you-serving-all-your.html

    http://developer.android.com/guide/topics/ui/accessibility/apps.html#test

    Android Lint contentDescription warning

    0 讨论(0)
  • 2020-12-30 03:05

    Lint support in ADT 16 and above throws this warning

    Now question is why this is needed.

    Consider scenario where you have designed application which have ImageView with some image.The image carries message what it does.But there may be a blind person who can not see.So in that case if you have used contentDescription attribute then Text-To-Speech functionality will read the value so even blind person will come to for what purpose image is placed there even though he can't see it.

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

    Widgets like ImageViews and ImageButtons should use the contentDescription attribute to specify a textual description of the widget such that screen readers Text-To-Speech and other accessibility tools can adequately describe the user interface.

    0 讨论(0)
  • 2020-12-30 03:09

    Just add this:

    android:contentDescription="@string/description"
    

    then go to yours Strings.xml and add this:

    <string name="description"> YOUR_DESCRIPTION_HERE </string>
    
    0 讨论(0)
  • 2020-12-30 03:12

    In Eclipse

    Window->prefrences->Android->Lint Error Checking->Issues-> Accessibility->Content Decription->Severty select Ignore.

    OR

    add android:contentDescription in ImageView.

    • See here For More About Lint Error Checking
    0 讨论(0)
提交回复
热议问题