RecyclerViewAccessibilityDelegate


class RecyclerViewAccessibilityDelegate : AccessibilityDelegateCompat


The AccessibilityDelegate used by RecyclerView.

This class handles basic accessibility actions and delegates them to LayoutManager.

Summary

Nested types

The default implementation of accessibility delegate for the individual items of the RecyclerView.

Public constructors

Public functions

AccessibilityDelegateCompat

Gets the AccessibilityDelegate for an individual item in the RecyclerView.

Unit

Initializes an AccessibilityEvent with information about the the host View which is the event source.

Unit

Initializes an AccessibilityNodeInfoCompat with information about the host view.

Boolean
performAccessibilityAction(host: View, action: Int, args: Bundle?)

Performs the specified accessibility action on the view.

Inherited functions

From androidx.core.view.AccessibilityDelegateCompat
Boolean

Dispatches an AccessibilityEvent to the host View first and then to its children for adding their text content to the event.

AccessibilityNodeProviderCompat?

Gets the provider for managing a virtual view hierarchy rooted at this View and reported to AccessibilityServices that explore the window content.

Unit

Gives a chance to the host View to populate the accessibility event with its text content.

Boolean
onRequestSendAccessibilityEvent(
    host: ViewGroup,
    child: View,
    event: AccessibilityEvent
)

Called when a child of the host View has requested sending an AccessibilityEvent and gives an opportunity to the parent (the host) to augment the event.

Unit
sendAccessibilityEvent(host: View, eventType: Int)

Sends an accessibility event of the given type.

Unit

Sends an accessibility event.

Public constructors

RecyclerViewAccessibilityDelegate

Added in 1.0.0
RecyclerViewAccessibilityDelegate(recyclerView: RecyclerView)

Public functions

getItemDelegate

Added in 1.0.0
fun getItemDelegate(): AccessibilityDelegateCompat

Gets the AccessibilityDelegate for an individual item in the RecyclerView. A basic item delegate is provided by default, but you can override this method to provide a custom per-item delegate. For now, returning an AccessibilityDelegateCompat as opposed to an ItemDelegate will prevent use of the ViewCompat accessibility API on item views.

onInitializeAccessibilityEvent

fun onInitializeAccessibilityEvent(host: View, event: AccessibilityEvent): Unit

Initializes an AccessibilityEvent with information about the the host View which is the event source.

The default implementation behaves as ViewCompat#onInitalizeAccessibilityEvent(View v, AccessibilityEvent event) for the case of no accessibility delegate been set.

Parameters
host: View

The View hosting the delegate.

event: AccessibilityEvent

The event to initialize.

See also
onInitializeAccessibilityEvent

ViewCompat#onInitializeAccessibilityEvent(View, AccessibilityEvent)

onInitializeAccessibilityNodeInfo

fun onInitializeAccessibilityNodeInfo(
    host: View,
    info: AccessibilityNodeInfoCompat
): Unit

Initializes an AccessibilityNodeInfoCompat with information about the host view.

The default implementation behaves as ViewCompat#onInitializeAccessibilityNodeInfo(View, AccessibilityNodeInfoCompat) for the case of no accessibility delegate been set.

Parameters
host: View

The View hosting the delegate.

info: AccessibilityNodeInfoCompat

The instance to initialize.

See also
onInitializeAccessibilityNodeInfo

ViewCompat#onInitializeAccessibilityNodeInfo(View, AccessibilityNodeInfoCompat)

performAccessibilityAction

fun performAccessibilityAction(host: View, action: Int, args: Bundle?): Boolean

Performs the specified accessibility action on the view. For possible accessibility actions look at AccessibilityNodeInfoCompat.

The default implementation behaves as View#performAccessibilityAction(int, Bundle) for the case of no accessibility delegate been set.

Parameters
host: View

View on which to perform the action.

action: Int

The action to perform.

args: Bundle?

Optional action arguments.

Returns
Boolean

Whether the action was performed.

See also
performAccessibilityAction

View#performAccessibilityAction(int, Bundle)