When Talkback is announcing the element , it must be focused that announcing element .
Auto (0): This is the default, it is the system that decides.
Yes (1): The view is important for accessibility. For example, it can receive the TalkBack focus.
No (2): The view is not important for accessibility. It does not trigger accessibility events and is therefore ignored by accessibility services such as TalkBack.
NoHideDescendants (4): The view is not important for accessibility, nor are its children views.
Here , @+id/textHide , will not get focused & not announced . Remaining two will announce.
For more info :
https://developer.android.com/reference/android/view/View#attr_android:importantForAccessibility
Specifies the id of a view for which this view serves as a label for accessibility purposes. For example, a TextView before an EditText in the UI usually specifies what information is contained in the EditText. Hence, the TextView is a label for the EditText.
Demo :
ACCESSIBILITY_LIVE_REGION_NONE: This is the default for most views , not live region.
ACCESSIBILITY_LIVE_REGION_POLITE: When a change occurs, talkback are triggered by the changes. they have lower priority than system by default announcements.
ACCESSIBILITY_LIVE_REGION_ASSERTIVE: When a change occurs, are triggered by the changes, having the highest priority and are immediately announce.
For example : Any list is having filter button , and data of the list is changing by applying the filters on it , in that case , this attribute can be useful , because list is changing again and again.
- ImportantForAccessibility :
Auto (0): This is the default, it is the system that decides.
Yes (1): The view is important for accessibility. For example, it can receive the TalkBack focus.
No (2): The view is not important for accessibility. It does not trigger accessibility events and is therefore ignored by accessibility services such as TalkBack.
NoHideDescendants (4): The view is not important for accessibility, nor are its children views.
<TextView android:id="@+id/textShow" android:importantForAccessibility="yes" android:text="Title" /> <TextView android:id="@+id/textHide" android:importantForAccessibility="no" android:text="Should Not Announce" /> <TextView android:id="@+id/textDesc" android:importantForAccessibility="yes" android:text="Description" />
Here , @+id/textHide , will not get focused & not announced . Remaining two will announce.
For more info :
https://developer.android.com/reference/android/view/View#attr_android:importantForAccessibility
- LabelFor :
<TextView android:id="@+id/textName" android:text="Enter Name" android:labelFor="@+id/editTextTextPersonName" /> <EditText android:id="@+id/editTextTextPersonName" android:inputType="textPersonName" />
For more info : https://developer.android.com/guide/topics/ui/accessibility/principles#content-pairs
- Reordering Elements :
This helps to set a logical focus order of the elements inside a view-group , there are 2 main attributes which helps to set the order :
- android:accessibilityTraversalBefore on a view to specify what item this should come before .
- android:accessibilityTraversalAfter on a view to specify what item this should come after .
<TextView android:id="@+id/textShow" android:text="Title" /> <TextView android:id="@+id/textLast" android:text="Should Announce in last" android:accessibilityTraversalAfter="@id/textDesc"/> <TextView android:id="@+id/textDesc" android:text="Description" android:accessibilityTraversalAfter="@id/textShow"/>
Demo :
- Changing Content :
ACCESSIBILITY_LIVE_REGION_NONE: This is the default for most views , not live region.
ACCESSIBILITY_LIVE_REGION_POLITE: When a change occurs, talkback are triggered by the changes. they have lower priority than system by default announcements.
ACCESSIBILITY_LIVE_REGION_ASSERTIVE: When a change occurs, are triggered by the changes, having the highest priority and are immediately announce.
For example : Any list is having filter button , and data of the list is changing by applying the filters on it , in that case , this attribute can be useful , because list is changing again and again.
- AnnouncementForAccessibility :
amount.announceForAccessibility(getString(R.string.count))
These are many more attributes , which can be used for accessibility implementation.
No comments:
Post a Comment