View.AnnounceForAccessibility Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
AnnounceForAccessibility(ICharSequence) |
Convenience method for sending a |
AnnounceForAccessibility(String) |
Convenience method for sending a |
AnnounceForAccessibility(ICharSequence)
Convenience method for sending a AccessibilityEvent#TYPE_ANNOUNCEMENT
AccessibilityEvent
to suggest that an accessibility service announce the
specified text to its users.
[Android.Runtime.Register("announceForAccessibility", "(Ljava/lang/CharSequence;)V", "GetAnnounceForAccessibility_Ljava_lang_CharSequence_Handler")]
public virtual void AnnounceForAccessibility (Java.Lang.ICharSequence? text);
[<Android.Runtime.Register("announceForAccessibility", "(Ljava/lang/CharSequence;)V", "GetAnnounceForAccessibility_Ljava_lang_CharSequence_Handler")>]
abstract member AnnounceForAccessibility : Java.Lang.ICharSequence -> unit
override this.AnnounceForAccessibility : Java.Lang.ICharSequence -> unit
Parameters
- text
- ICharSequence
The announcement text.
- Attributes
Remarks
Convenience method for sending a AccessibilityEvent#TYPE_ANNOUNCEMENT
AccessibilityEvent
to suggest that an accessibility service announce the specified text to its users.
Note: The event generated with this API carries no semantic meaning, and is appropriate only in exceptional situations. Apps can generally achieve correct behavior for accessibility by accurately supplying the semantics of their UI. They should not need to specify what exactly is announced to users.
In general, only announce transitions and don't generate a confirmation message for simple actions like a button press. Label your controls concisely and precisely instead, and for significant UI changes like window changes, use android.app.Activity#setTitle(CharSequence)
and #setAccessibilityPaneTitle(CharSequence)
.
Use #setAccessibilityLiveRegion(int)
to inform the user of changes to critical views within the user interface. These should still be used sparingly as they may generate announcements every time a View is updated.
For notifying users about errors, such as in a login screen with text that displays an "incorrect password" notification, that view should send an AccessibilityEvent of type AccessibilityEvent#CONTENT_CHANGE_TYPE_ERROR
and set AccessibilityNodeInfo#setError(CharSequence)
instead. Custom widgets should expose error-setting methods that support accessibility automatically. For example, instead of explicitly sending this event when using a TextView, use android.widget.TextView#setError(CharSequence)
.
Use #setStateDescription(CharSequence)
to convey state changes to views within the user interface. While a live region may send different types of events generated by the view, state description will send AccessibilityEvent#TYPE_WINDOW_CONTENT_CHANGED
events of type AccessibilityEvent#CONTENT_CHANGE_TYPE_STATE_DESCRIPTION
.
Java documentation for android.view.View.announceForAccessibility(java.lang.CharSequence)
.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.
Applies to
AnnounceForAccessibility(String)
Convenience method for sending a AccessibilityEvent#TYPE_ANNOUNCEMENT
AccessibilityEvent
to suggest that an accessibility service announce the
specified text to its users.
public void AnnounceForAccessibility (string? text);
member this.AnnounceForAccessibility : string -> unit
Parameters
- text
- String
The announcement text.
Remarks
Convenience method for sending a AccessibilityEvent#TYPE_ANNOUNCEMENT
AccessibilityEvent
to suggest that an accessibility service announce the specified text to its users.
Note: The event generated with this API carries no semantic meaning, and is appropriate only in exceptional situations. Apps can generally achieve correct behavior for accessibility by accurately supplying the semantics of their UI. They should not need to specify what exactly is announced to users.
In general, only announce transitions and don't generate a confirmation message for simple actions like a button press. Label your controls concisely and precisely instead, and for significant UI changes like window changes, use android.app.Activity#setTitle(CharSequence)
and #setAccessibilityPaneTitle(CharSequence)
.
Use #setAccessibilityLiveRegion(int)
to inform the user of changes to critical views within the user interface. These should still be used sparingly as they may generate announcements every time a View is updated.
For notifying users about errors, such as in a login screen with text that displays an "incorrect password" notification, that view should send an AccessibilityEvent of type AccessibilityEvent#CONTENT_CHANGE_TYPE_ERROR
and set AccessibilityNodeInfo#setError(CharSequence)
instead. Custom widgets should expose error-setting methods that support accessibility automatically. For example, instead of explicitly sending this event when using a TextView, use android.widget.TextView#setError(CharSequence)
.
Use #setStateDescription(CharSequence)
to convey state changes to views within the user interface. While a live region may send different types of events generated by the view, state description will send AccessibilityEvent#TYPE_WINDOW_CONTENT_CHANGED
events of type AccessibilityEvent#CONTENT_CHANGE_TYPE_STATE_DESCRIPTION
.
Java documentation for android.view.View.announceForAccessibility(java.lang.CharSequence)
.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.