在定义一个ImageVIew ImageButton的时候 

总是提示这个[Accessibility] Missing contentDescription attribute on image警告


原来这是ADT 16.0的新特性,在一些没有文本显示的控件里,如imageView和imageButton等,

ADT会提示你定义一个android:contentDescription属性,用来描述这个控件的作用。

所以 



只要加上下面这个属性即可:


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.


更多相关文章

  1. Android(安卓)控件之FlexboxLayout知识梳理
  2. android使用艺术字,自定义字体
  3. ScrollView隐藏、调整大小
  4. Android自定义控件中的自定义attrs
  5. Android中persistent属性用法详解
  6. Android(安卓)设计模式 笔记 - 深入了解属性动画
  7. Android的一个自定义的动态添加Dialog类
  8. Android(安卓)常用权限和使用说明
  9. Android(安卓)学习之- 单选按钮、复选框、状态开关、时钟控件

随机推荐

  1. unix like系统的android反编译工具
  2. [Android]IPC通信之Messenger的使用方法
  3. 个人知识体系(持续更新)
  4. android设备获取当前wifi下的路由器的mac
  5. Android发送xml数据给服务器的方法
  6. Android函数计算器(含源码,Android测试工程
  7. Java中为何与0xff进行与运算
  8. android下m、mm、mmm编译命令的使用
  9. Android(安卓)学生信息管理系统
  10. 使用Visual Studio 2015开发Android(安卓