您的位置:首页 > 移动开发 > Android开发

【Android】 使用ADT16出现ImageView Warning:Missing content Description attribute on image

2012-01-30 18:04 736 查看
转载自http://stackoverflow.com/questions/8500544/android-lint-contentdescription-warning

在使用ADT 16开发android程序时会发现在XML文件中定义ImageView总是会提示Warning:Missing content Description attribute on image的警告

我们可以使用添加android:contentDescription="@string/desc"的方式来解决这个问题,

具体解释参考下面的描述:

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.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐