# RecyclerViewAccessibilityDelegate

Artifact: [androidx.recyclerview:recyclerview](https://developer.android.com/jetpack/androidx/releases/recyclerview) [View Source](https://cs.android.com/search?q=file:androidx/recyclerview/widget/RecyclerViewAccessibilityDelegate.java+class:androidx.recyclerview.widget.RecyclerViewAccessibilityDelegate) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/recyclerview#1.0.0)

*** ** * ** ***


```
public class RecyclerViewAccessibilityDelegate extends AccessibilityDelegateCompat
```

<br />

|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object.html) |||
| ↳ | [androidx.core.view.AccessibilityDelegateCompat](https://developer.android.com/reference/androidx/core/view/AccessibilityDelegateCompat) ||
|   | ↳ | [androidx.recyclerview.widget.RecyclerViewAccessibilityDelegate](https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerViewAccessibilityDelegate) |

*** ** * ** ***

The AccessibilityDelegate used by RecyclerView.

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

## Summary

| ### Nested types |
|---|
| `public class https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerViewAccessibilityDelegate.ItemDelegate extends https://developer.android.com/reference/androidx/core/view/AccessibilityDelegateCompat` The default implementation of accessibility delegate for the individual items of the RecyclerView. |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerViewAccessibilityDelegate#RecyclerViewAccessibilityDelegate(androidx.recyclerview.widget.RecyclerView)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView recyclerView)` |

| ### Public methods |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/core/view/AccessibilityDelegateCompat` | `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerViewAccessibilityDelegate#getItemDelegate()()` Gets the AccessibilityDelegate for an individual item in the RecyclerView. |
| `void` | `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerViewAccessibilityDelegate#onInitializeAccessibilityEvent(android.view.View,android.view.accessibility.AccessibilityEvent)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/view/View.html host, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/view/accessibility/AccessibilityEvent.html event )` Initializes an `https://developer.android.com/reference/android/view/accessibility/AccessibilityEvent.html` with information about the the host View which is the event source. |
| `void` | `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerViewAccessibilityDelegate#onInitializeAccessibilityNodeInfo(android.view.View,androidx.core.view.accessibility.AccessibilityNodeInfoCompat)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/view/View.html host, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/core/view/accessibility/AccessibilityNodeInfoCompat info )` Initializes an `https://developer.android.com/reference/androidx/core/view/accessibility/AccessibilityNodeInfoCompat` with information about the host view. |
| `boolean` | `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerViewAccessibilityDelegate#performAccessibilityAction(android.view.View,int,android.os.Bundle)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/view/View.html host, int action, @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/android/os/Bundle.html args )` Performs the specified accessibility action on the view. |

| ### Inherited methods |
|---|
| From [androidx.core.view.AccessibilityDelegateCompat](https://developer.android.com/reference/androidx/core/view/AccessibilityDelegateCompat) |---|---| | `boolean` | `https://developer.android.com/reference/androidx/core/view/AccessibilityDelegateCompat#dispatchPopulateAccessibilityEvent(android.view.View,android.view.accessibility.AccessibilityEvent)( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/View.html host, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/accessibility/AccessibilityEvent.html event )` Dispatches an `https://developer.android.com/reference/android/view/accessibility/AccessibilityEvent.html` to the host `https://developer.android.com/reference/android/view/View.html` first and then to its children for adding their text content to the event. | | `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/core/view/accessibility/AccessibilityNodeProviderCompat` | `https://developer.android.com/reference/androidx/core/view/AccessibilityDelegateCompat#getAccessibilityNodeProvider(android.view.View)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/View.html host)` Gets the provider for managing a virtual view hierarchy rooted at this View and reported to `https://developer.android.com/reference/android/accessibilityservice/AccessibilityService.html`s that explore the window content. | | `void` | `https://developer.android.com/reference/androidx/core/view/AccessibilityDelegateCompat#onPopulateAccessibilityEvent(android.view.View,android.view.accessibility.AccessibilityEvent)( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/View.html host, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/accessibility/AccessibilityEvent.html event )` Gives a chance to the host View to populate the accessibility event with its text content. | | `boolean` | `https://developer.android.com/reference/androidx/core/view/AccessibilityDelegateCompat#onRequestSendAccessibilityEvent(android.view.ViewGroup,android.view.View,android.view.accessibility.AccessibilityEvent)( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/ViewGroup.html host, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/View.html child, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/accessibility/AccessibilityEvent.html event )` Called when a child of the host View has requested sending an `https://developer.android.com/reference/android/view/accessibility/AccessibilityEvent.html` and gives an opportunity to the parent (the host) to augment the event. | | `void` | `https://developer.android.com/reference/androidx/core/view/AccessibilityDelegateCompat#sendAccessibilityEvent(android.view.View,int)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/View.html host, int eventType)` Sends an accessibility event of the given type. | | `void` | `https://developer.android.com/reference/androidx/core/view/AccessibilityDelegateCompat#sendAccessibilityEventUnchecked(android.view.View,android.view.accessibility.AccessibilityEvent)( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/View.html host, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/accessibility/AccessibilityEvent.html event )` Sends an accessibility event. | |

## Public constructors

### RecyclerViewAccessibilityDelegate

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/recyclerview#1.0.0)

```
public RecyclerViewAccessibilityDelegate(@NonNull RecyclerView recyclerView)
```

## Public methods

### getItemDelegate

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/recyclerview#1.0.0)

```
public @NonNull AccessibilityDelegateCompat getItemDelegate()
```

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

```
public void onInitializeAccessibilityEvent(
    @NonNull View host,
    @NonNull AccessibilityEvent event
)
```

Initializes an `https://developer.android.com/reference/android/view/accessibility/AccessibilityEvent.html` with information about the the host View which is the event source.

The default implementation behaves as `https://developer.android.com/reference/androidx/core/view/ViewCompat#onInitializeAccessibilityEvent(android.view.View,android.view.accessibility.AccessibilityEvent)` for the case of no accessibility delegate been set.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/view/View.html host` | The View hosting the delegate. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/view/accessibility/AccessibilityEvent.html event` | The event to initialize. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/core/view/ViewCompat#onInitializeAccessibilityEvent(android.view.View,android.view.accessibility.AccessibilityEvent)` | ViewCompat#onInitializeAccessibilityEvent(View, AccessibilityEvent) |

### onInitializeAccessibilityNodeInfo

```
public void onInitializeAccessibilityNodeInfo(
    @NonNull View host,
    @NonNull AccessibilityNodeInfoCompat info
)
```

Initializes an `https://developer.android.com/reference/androidx/core/view/accessibility/AccessibilityNodeInfoCompat` with information about the host view.

The default implementation behaves as `https://developer.android.com/reference/androidx/core/view/ViewCompat#onInitializeAccessibilityNodeInfo(android.view.View,androidx.core.view.accessibility.AccessibilityNodeInfoCompat)` for the case of no accessibility delegate been set.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/view/View.html host` | The View hosting the delegate. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/core/view/accessibility/AccessibilityNodeInfoCompat info` | The instance to initialize. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/core/view/ViewCompat#onInitializeAccessibilityNodeInfo(android.view.View,androidx.core.view.accessibility.AccessibilityNodeInfoCompat)` | ViewCompat#onInitializeAccessibilityNodeInfo(View, AccessibilityNodeInfoCompat) |

### performAccessibilityAction

```
public boolean performAccessibilityAction(
    @NonNull View host,
    int action,
    @Nullable Bundle args
)
```

Performs the specified accessibility action on the view. For possible accessibility actions look at `https://developer.android.com/reference/androidx/core/view/accessibility/AccessibilityNodeInfoCompat`.

The default implementation behaves as `https://developer.android.com/reference/android/view/View.html#performAccessibilityAction(int, android.os.Bundle)` for the case of no accessibility delegate been set.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/view/View.html host` | View on which to perform the action. |
| `int action` | The action to perform. |
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/android/os/Bundle.html args` | Optional action arguments. |

| Returns |
|---|---|
| `boolean` | Whether the action was performed. |

| See also |
|---|---|
| `https://developer.android.com/reference/android/view/View.html#performAccessibilityAction(int, android.os.Bundle)` | View#performAccessibilityAction(int, Bundle) |