今天使用了下ADT 16.0 在定义一个ImageVIew的时候 总是提示这个[Accessibility] Missing contentDescription attribute on image警告,虽说可以不理 但总是感觉怪怪的,在网上一搜 发现原来这是ADT 16.0的新特性,在一些没有文本显示的控件里,如imageView和imageButton等,ADT会提示你定义一个android:contentDescription属性,用来描述这个控件的作用。英文原文如下,如有翻译的不对的地方,敬请批评指正。
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.
转自http://blog.youkuaiyun.com/hn307165411/article/details/7179317
本文详细介绍了在使用ADT16.0时遇到的关于ImageView缺少contentDescription属性的警告问题,并解释了这一新特性的背景和原因。文章提供了解决方案,即为ImageView设置android:contentDescription属性,以确保无障碍功能的实现。通过理解这一特性,开发者可以更好地适应ADT16.0的更新,确保应用的无障碍性和用户体验。
1148

被折叠的 条评论
为什么被折叠?



