如何让TalkBack忽略android:text元素?

ing*_*nga 0 xml android accessibility textview talkback

我正在改进我的Android应用程序中的视障人士的可访问性.我在Android项目的popover.xml文件中有以下TextView.

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginBottom="12dp"
    android:text="@string/pass_code"/>
Run Code Online (Sandbox Code Playgroud)

每当我使用TalkBack测试应用程序时,应用程序会回拨字符串,android:text但在这种情况下,我根本不想要它被说出来,因为这是一个弹出窗口,所以我宁愿一旦窗口说出来砰的一声.所以我已经android:contentDescription="@string/pass_code"在我的根LinearLayout中说出了相同的字符串.

我试图设置android:contentDescription="@null",我也试过添加,tools:ignore="ContentDescription"但他们都没有工作.android:text中的元素总是被说出来.如何更改TextView,以便TalkBack将忽略android:text元素?

ala*_*anv 8

您可以通过android:importantForAccessibility="no"在布局XML中设置来隐藏辅助服务中的视图.有关更多详细信息,请参阅View.setImportantForAccessibility(int)的开发人员文档.