加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

layout中的xml文件提示Missing contentDescription attribute on

发布时间:2020-12-16 08:52:14 所属栏目:百科 来源:网络整理
导读:(2012-11-14 16:00:42) 使用ADT 16.0或者以上版本时,用户定义一个ImageView,会提示 [Accessibility] Missing contentDescription attribute on image,虽说 这个警告 可以忽略不计,但总让人感觉不舒服。 其实, 这是ADT 16.0的新特性,在一些没有文本显示

(2012-11-14 16:00:42)

使用ADT 16.0或者以上版本时,用户定义一个ImageView,会提示[Accessibility] Missing contentDescription attribute on image,虽说这个警告可以忽略不计,但总让人感觉不舒服。

其实,这是ADT 16.0的新特性,在一些没有文本显示的控件里,如imageView和imageButton等,ADT会提示你添加一个android:contentDescription属性,用来描述这个控件的作用。(而且值引用strings.xml文件中的,否则又会有提示。)

英文原文如下:

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.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读