Most visited

Recently visited

AccessibilityDelegateCompat

public class AccessibilityDelegateCompat
extends Object

java.lang.Object
   ↳ android.support.v4.view.AccessibilityDelegateCompat
Known Direct Subclasses


助手以向后兼容的方式访问API级别4之后引入的 View.AccessibilityDelegate

注意:API 23之前的平台版本上, 主机方法之前调用android.widget.*包中视图的android.widget.*方法。 这可以通过覆盖onInitializeAccessibilityNodeInfo(View, AccessibilityNodeInfoCompat)防止某些属性(如类名)被修改,因为任何更改都将被主机类覆盖。

API 23开始, 主机方法 之后调用委托方法,所有属性都将被修改而不被主机类覆盖。

Summary

Public constructors

AccessibilityDelegateCompat()

创建一个新的实例。

Public methods

boolean dispatchPopulateAccessibilityEvent(View host, AccessibilityEvent event)

首先将 AccessibilityEvent发给主机 View ,然后分发给其子项以将其文本内容添加到事件中。

AccessibilityNodeProviderCompat getAccessibilityNodeProvider(View host)

获取用于管理以此视图为根的虚拟视图层次结构的提供者,并将其报告给探索窗口内容的 AccessibilityService

void onInitializeAccessibilityEvent(View host, AccessibilityEvent event)

使用有关作为事件源的主机View的信息初始化 AccessibilityEvent

void onInitializeAccessibilityNodeInfo(View host, AccessibilityNodeInfoCompat info)

使用有关主机视图的信息初始化 AccessibilityNodeInfoCompat

void onPopulateAccessibilityEvent(View host, AccessibilityEvent event)

为主持人视图提供一个机会,用其文本内容填充辅助功能事件。

boolean onRequestSendAccessibilityEvent(ViewGroup host, View child, AccessibilityEvent event)

当主持人View的一个孩子要求发送一个 AccessibilityEvent并给父母(主持人)提供机会来增加事件时调用。

boolean performAccessibilityAction(View host, int action, Bundle args)

在视图上执行指定的辅助功能操作。

void sendAccessibilityEvent(View host, int eventType)

发送给定类型的可访问性事件。

void sendAccessibilityEventUnchecked(View host, AccessibilityEvent event)

发送可访问性事件。

Inherited methods

From class java.lang.Object

Public constructors

AccessibilityDelegateCompat

AccessibilityDelegateCompat ()

创建一个新的实例。

Public methods

dispatchPopulateAccessibilityEvent

boolean dispatchPopulateAccessibilityEvent (View host, 
                AccessibilityEvent event)

首先将 AccessibilityEvent发给主持人 View ,然后再分发给其子女,以便将其文本内容添加到事件中。

对于未设置可访问性委托的情况,默认实现的行为为 View#dispatchPopulateAccessibilityEvent(AccessibilityEvent)

Parameters
host View: The View hosting the delegate.
event AccessibilityEvent: The event.
Returns
boolean True if the event population was completed.

也可以看看:

getAccessibilityNodeProvider

AccessibilityNodeProviderCompat getAccessibilityNodeProvider (View host)

获取用于管理以此视图为根的虚拟视图层次结构的提供者,并报告给探索窗口内容的 AccessibilityService

对于没有设置可访问性委托的情况,默认实现的行为为 ViewCompat#getAccessibilityNodeProvider(View)

Parameters
host View
Returns
AccessibilityNodeProviderCompat The provider.

也可以看看:

onInitializeAccessibilityEvent

void onInitializeAccessibilityEvent (View host, 
                AccessibilityEvent event)

使用有关作为事件源的主机View的信息初始化 AccessibilityEvent

对于未设置可访问性委托的情况,默认实现的行为为 ViewCompat#onInitalizeAccessibilityEvent(View v, AccessibilityEvent event)

Parameters
host View: The View hosting the delegate.
event AccessibilityEvent: The event to initialize.

也可以看看:

onInitializeAccessibilityNodeInfo

void onInitializeAccessibilityNodeInfo (View host, 
                AccessibilityNodeInfoCompat info)

使用有关主机视图的信息初始化 AccessibilityNodeInfoCompat

对于没有设置可访问性委托的情况,默认实现的行为为 ViewCompat#onInitializeAccessibilityNodeInfo(View, AccessibilityNodeInfoCompat)

Parameters
host View: The View hosting the delegate.
info AccessibilityNodeInfoCompat: The instance to initialize.

也可以看看:

onPopulateAccessibilityEvent

void onPopulateAccessibilityEvent (View host, 
                AccessibilityEvent event)

为主持人视图提供一个机会,用其文本内容填充辅助功能事件。

对于没有设置可访问性委托的情况,默认实现的行为为 ViewCompat#onPopulateAccessibilityEvent(AccessibilityEvent)

Parameters
host View: The View hosting the delegate.
event AccessibilityEvent: The accessibility event which to populate.

也可以看看:

onRequestSendAccessibilityEvent

boolean onRequestSendAccessibilityEvent (ViewGroup host, 
                View child, 
                AccessibilityEvent event)

当主视图的孩子请求发送 AccessibilityEvent并给父母(主持人)提供机会以增强事件时调用。

对于未设置可访问性委托的情况,默认实现的行为为 ViewGroupCompat#onRequestSendAccessibilityEvent(ViewGroup, View, AccessibilityEvent)

Parameters
host ViewGroup: The View hosting the delegate.
child View: The child which requests sending the event.
event AccessibilityEvent: The event to be sent.
Returns
boolean True if the event should be sent

也可以看看:

performAccessibilityAction

boolean performAccessibilityAction (View host, 
                int action, 
                Bundle args)

在视图上执行指定的辅助功能操作。 有关可能的辅助功能操作,请AccessibilityNodeInfoCompat

对于未设置可访问性委托的情况,默认实现的行为为 View#performAccessibilityAction(int, Bundle)

Parameters
host View
action int: The action to perform.
args Bundle
Returns
boolean Whether the action was performed.

也可以看看:

sendAccessibilityEvent

void sendAccessibilityEvent (View host, 
                int eventType)

发送给定类型的可访问性事件。 如果未启用辅助功能,则此方法不起作用。

对于没有设置可访问性委托的情况,默认实现的行为为 View#sendAccessibilityEvent(int)

Parameters
host View: The View hosting the delegate.
eventType int: The type of the event to send.

也可以看看:

sendAccessibilityEventUnchecked

void sendAccessibilityEventUnchecked (View host, 
                AccessibilityEvent event)

发送可访问性事件。 此方法的行为与sendAccessibilityEvent(View, int)完全相同,但将空白AccessibilityEvent作为参数,并且不执行检查是否启用辅助功能。

对于没有设置可访问性委托的情况,默认实现的行为为 View#sendAccessibilityEventUnchecked(AccessibilityEvent)

Parameters
host View: The View hosting the delegate.
event AccessibilityEvent: The event to send.

也可以看看:

Hooray!