Android TalkBack:提示会覆盖contentDescription [英] Android TalkBack: Hint overwrites contentDescription

查看:470
本文介绍了Android TalkBack:提示会覆盖contentDescription的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个如下所示的EditText

I have an EditText like below

<EditText
    android:id="@+id/extUsername"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:contentDescription="Username field"
    android:hint="Username" />

我希望话语提示说用户名字段,但说用户名。它会忽略contentDescription。

I want TalkBack to say "Username field" but it says "Username". It ignores contentDescription.

不要告诉我删除提示或contentDescription。我需要同时使用两者。

Do not tell me to remove hint or contentDescription. I need to use both.

任何建议都将不胜感激。

Any advices will be appreciated.

推荐答案

您要做的是改用LabelFor。 LabelFor允许将可视标签与EditText框关联。您可以根据需要使视觉标签不可见,以免改变视觉布局。

What you want to do is use LabelFor instead. LabelFor allows a visual label to be associated with an EditText box. You can make the visual label invisible if you'd like, so that it doesn't change your visual layout.

提示的缺点是,它们在输入文本后消失,这使它们成为可访问性非常差的工具。如果您依赖辅助功能信息的提示,则您的应用程序不可访问。

The down side to hints, is that they disappear after text is entered, making them pretty poor accessibility tools. If you're relying on hints for your Accessibility information, your app is not accessible.

执行以下操作:

<TextView
     android:text="@string/yourEditTextDescription"
     android:labelFor="@+id/editTextField" />

<EditText android:id="@+id/editTextField"/>

这篇关于Android TalkBack:提示会覆盖contentDescription的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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