Reputation: 3214
I am improving the accessibility for visually impaired in my android app. I have the following TextView in a popover.xml file in my Android project.
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="12dp"
android:text="@string/pass_code"/>
Whenever I test the app with TalkBack, the app speaks back the string in android:text
but in this case I don't want it to be spoken at all because this is a popover window so I would rather want it to be spoken as soon as the window pops over. So I've got android:contentDescription="@string/pass_code"
in my root LinearLayout which speaks out the same string.
I've tried to set android:contentDescription="@null"
and I've also tried adding tools:ignore="ContentDescription"
but neither of them worked. The element in android:text is always spoken. How can I change the TextView so TalkBack will ignore the android:text element?
Upvotes: 4
Views: 5680
Reputation: 24114
You can hide a view from accessibility services by setting android:importantForAccessibility="no"
in your layout XML. See the developer docs for View.setImportantForAccessibility(int) for more details.
Upvotes: 20