Android:contentDescription 不是无用
在写Android的XML布局文件时,在ImageView或ImageButton中经常会碰到一个提示: Missing contentDescription attribute on image.
在Android 的图片显示类的控件中,不写 android:contentDescription 往往会有警告(Eclipse开发时),这个属性是方便一些生理功能有缺陷的人使用应用程序的,比如一些视力有障碍的用户,如果用户安装了辅助浏览工具比如TalkBack,TalkBack就会大声朗读出用户目前正在浏览的内容。TextView控件TalkBack可以直接读出里面的内容(contentDescription的值),告诉用户这个图片到底是什么。
TalkBack的使用:
android:contentDescription 这个属性必须在用户的Accessible 中的相应属性开启后才能使用。
1. 首先下载google的应用 TalkBack (an accessibility service published by Google) 并且将功能打开 Settings > Accessibility > TalkBack 设置为On。
2.在应用中添加这个属性。
<Button
android:id=”@+id/pause_button”
android:src=”@drawable/pause”
android:contentDescription=”@string/pause”/>
3.用户点击这个控件。android系统会自动使用人声朗读控件上android:contentDescription属性说指向的内容。
这个属性的主要功能就是为视力有障碍的人增加对控件的解释。
当然不想使用这个属性时,
android:contentDescription="@null"
即可!
同样
android:background="@null"
可以去除imagebutton丑陋的背景
参考:http://blog.csdn.net/yuxiaohui78/article/details/41206179
Android:contentDescription 不是无用的更多相关文章
- android:contentDescription的作用是什么
在写Android的XML布局文件时,在ImageView或ImageButton中经常会碰到一个提示: Missing contentDescription attribute on image. ...
- Android 控件属性介绍
1.LinearLayout(线性布局): 可以分为水平线性:android:orientation= " horizontal " 和垂直线性:android:orientati ...
- android 属性
RelativeLayout 第一类:属性值为true可false android:layout_centerHrizontal 水平居中 android:layout_centerVe ...
- Android 开发 View的API 转载
转载地址:https://blog.csdn.net/lemonrabbit1987/article/details/47704679 View类代表用户界面组件的基本构建块.一个View占据屏幕上的 ...
- 【Android界面实现】AppWidght全面学习之电量监控小部件的实现具体解释
版权声明:本文为博主原创文章,未经博主同意不得转载. https://blog.csdn.net/bz419927089/article/details/35791047 前几天翻看之前下载的各种资料 ...
- Android layout 布局 属性详解
第一类:属性值 true或者 false android:layout_centerHrizontal 水平居中 android:layout_centerVertical ...
- Android layout布局属性、标签属性总结大全
RelativeLayout 第一类:属性值为true可false android:layout_centerHrizontal 水平居中 android:layout_centerVe ...
- Android中控件属性详细总结(转载)
转载地址:https://www.cnblogs.com/nanguojs/p/5950510.html 1.LinearLayout(线性布局): 可以分为水平线性:android:orientat ...
- android studio你可能忽视的细节——启动白屏?drawable和mipmap出现的意义?这里都有!!!
android studio用了很久了,也不知道各位小伙伴有没有还在用eclipse的,如果还有,楼主真心推荐转到android studio来吧,毕竟亲儿子,你会知道除了启动速度稍微慢些,你找不到一 ...
随机推荐
- BZOJ 4129 Haruna’s Breakfast
传送门 同样是树上莫队 只不过要求一个集合的mex,这里可以使用分块,可以在根号时间内得出解 /************************************************** P ...
- python的特殊方法介绍
__repr__.__str__ __len__.__getitem__.__setitem__.__delitem__.__contains__ __iter__.__reversed__.__ne ...
- “微信小程序商城构建全栈应用”开发小记
注意事项: 1.application\api\extra下的wx.php记得填写小程序的app_id.app_secret: 2.API测试小工具需要APPID:
- Educational Codeforces Round 47 (Rated for Div. 2) 题解
题目链接:http://codeforces.com/contest/1009 A. Game Shopping 题目: 题意:有n件物品,你又m个钱包,每件物品的价格为ai,每个钱包里的前为bi.你 ...
- 使用Jupyter lab前应该读的几篇文章
知乎上的一篇文章: 如何优雅的使用Jupyter? Jupyter Lab原来还有如下使用方式: 执行Shell命令 Hintland(提示命令).snippets(插入代码段).一键美化代码等功能( ...
- Node、PHP、Java 和 Go 服务端 I/O 性能PK
http://blog.csdn.net/listen2you/article/details/72935679
- A - A Secret (扩展kmp)
题目链接:https://cn.vjudge.net/contest/283743#problem/A 题目大意:给你字符串s1和s2,然后问你s2的每一个后缀在s1中出现的次数之和(可重叠). 具体 ...
- JS window对象的top、parent、opener含义介绍
1.top该变更永远指分割窗口最高层次的浏览器窗口.如果计划从分割窗口的最高层次开始执行命令,就可以用top变量. 2.openeropener用于在window.open的页面引用执行该window ...
- Python中__repr__和__str__区别
Python中__repr__和__str__区别 看下面的例子就明白了 class Test(object): def __init__(self, value='hello, world!'): ...
- Python3 isinstance() 函数
Python3 isinstance() 函数 描述 isinstance() 函数来判断一个对象是否是一个已知的类型,类似 type(). isinstance() 与 type() 区别: typ ...