时辅助功能检查失败

时辅助功能检查失败

本文介绍了使用 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 将使提示无效.这基本上是它如何浮动标签(设置标签,取消提示).任何带有空提示的 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 时辅助功能检查失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-12 00:01