使用TextInputLayout时可访问性检查失败 [英] Accessibility Check fail when using TextInputLayout

查看:83
本文介绍了使用TextInputLayout时可访问性检查失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Android.support提供的新TextInputLayout做浮动标签。但这将导致Espresso可访问性检查失败,因为视图缺少屏幕阅读器所需的可说文本。

I'm using the new TextInputLayout provided by Android.support to do floating label. But it will fail Espresso Accessibility Check because "View is missing speakable text needed for a screen reader".

查看它并找出当父级执行addView()时TextInputLayout将使提示无效。基本上,这就是使标签浮动(设置标签,使提示无效)的方式。并且任何具有null提示的EditText都将无法通过可访问性检查。

Looked into it and find out the TextInputLayout will nullify hint when parent does addView(). This is basically how it can float the label up(set the label, nullify the hint). And any EditText with null hint will fail the accessibility check.

有人知道如何解决此问题吗?

Anyone knows how to resolve this issue? It's really driving me crazy..

非常感谢!!!

推荐答案

提示通常对可访问性不是很好。输入文本后它们消失。尝试改用 LabelFor。如果您不希望标签可见,可以将标签设置为不显示。

Hints aren't great for accessibility in general. They disappear when text is entered. Try using a "LabelFor" instead. If you don't want a visible label, you can set your label to not be displayed.

此应用程序将为您提供有关如何使文本框可访问的提示。

This app will give you hints on how to make text boxes accessible.

https://play.google.com/store/apps/details?id=com.dequesystems .accessibility101

这篇关于使用TextInputLayout时可访问性检查失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆