共用方式為


View.SendAccessibilityEvent(EventTypes) Method

Definition

Sends an accessibility event of the given type.

[Android.Runtime.Register("sendAccessibilityEvent", "(I)V", "GetSendAccessibilityEvent_IHandler")]
public virtual void SendAccessibilityEvent (Android.Views.Accessibility.EventTypes eventType);
[<Android.Runtime.Register("sendAccessibilityEvent", "(I)V", "GetSendAccessibilityEvent_IHandler")>]
abstract member SendAccessibilityEvent : Android.Views.Accessibility.EventTypes -> unit
override this.SendAccessibilityEvent : Android.Views.Accessibility.EventTypes -> unit

Parameters

eventType
EventTypes

The type of the event to send, as defined by several types from AccessibilityEvent, such as AccessibilityEvent#TYPE_VIEW_CLICKED or AccessibilityEvent#TYPE_VIEW_HOVER_ENTER.

Implements

Attributes

Remarks

Sends an accessibility event of the given type. If accessibility is not enabled this method has no effect. The default implementation calls #onInitializeAccessibilityEvent(AccessibilityEvent) first to populate information about the event source (this View), then calls #dispatchPopulateAccessibilityEvent(AccessibilityEvent) to populate the text content of the event source including its descendants, then for events type AccessibilityEvent#TYPE_VIEW_SCROLLED and AccessibilityEvent#TYPE_WINDOW_CONTENT_CHANGED with subtype AccessibilityEvent#CONTENT_CHANGE_TYPE_STATE_DESCRIPTION, throttle the events, and last calls ViewParent#requestSendAccessibilityEvent(View, AccessibilityEvent) on its parent to request sending of the event to interested parties.

If an AccessibilityDelegate has been specified via calling #setAccessibilityDelegate(AccessibilityDelegate) its AccessibilityDelegate#sendAccessibilityEvent(View, int) is responsible for handling this call.

If this view uses AccessibilityNodeProvider to provide virtual view hierarchy rooted at this view, this method should not be called to send events from virtual children because it will populate the events with wrong information and the events should be throttled per child instead at the virtual root level. To send events from virtual children, call ViewParent#requestSendAccessibilityEvent(View, AccessibilityEvent) on the view's parent to request sending of the event to interested parties.

Java documentation for android.view.View.sendAccessibilityEvent(int).

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

See also