辅助功能缺少图像上的contentDescription属性如何删除此警告?

Sal*_*jad 18 android

辅助功能]图像上缺少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" />
Run Code Online (Sandbox Code Playgroud)

Sam*_*iya 29

在Eclipse中

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

要么

添加android:contentDescriptionImageView.


Vip*_*hah 9

ADT 16及以上的棉绒支持会引发此警告

现在问题是为什么需要它.

考虑你设计了具有ImageView功能的应用程序的场景.图像带有它所做的信息.但是可能有一个盲人看不到.所以在这种情况下如果你使用了contentDescription属性那么Text-To-Speech功能将读取价值,所以即使他看不到它,即使盲人也会出于什么目的放置在那里.

contentDescription定义简要描述视图内容的文本.此属性主要用于辅助功能.由于某些视图没有文本表示,因此该属性可用于提供此类属性.

像ImageViews和ImageButtons这样的小部件应该使用contentDescription属性来指定小部件的文本描述,这样屏幕阅读器的Text-To-Speech和其他可访问性工具就可以充分描述用户界面.