首页 > 解决方案 > 图像浏览错误

问题描述

图像上缺少 contentDescription 属性 像 ImageViews 和 ImageButtons 这样的非文本小部件应该使用 contentDescription 属性来指定小部件的文本描述,以便屏幕阅读器和其他辅助工具可以充分描述用户界面。请注意,应用程序屏幕中纯装饰性且不提供任何内容或启用用户操作的元素不应具有可访问性内容描述。在这种情况下,只需使用工具抑制 lint 警告,忽略“ContentDescription”属性。请注意,对于文本字段,您不应同时设置提示和 contentDescription 属性,因为提示永远不会显示。只需设置提示。看

标签: android

解决方案


在 imageview /imagebutton 的布局中添加 contentDescription="some text" 不要在这些视图中添加提示。contentDescription 和 hint 不应在同一视图中检查布局的 xml。


推荐阅读