# RecyclerView.OnChildAttachStateChangeListener

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

*** ** * ** ***


```
public interface RecyclerView.OnChildAttachStateChangeListener
```

<br />

Known direct subclasses [ItemTouchHelper](https://developer.android.com/reference/androidx/recyclerview/widget/ItemTouchHelper)

|---|---|
| `https://developer.android.com/reference/androidx/recyclerview/widget/ItemTouchHelper` | This is a utility class to add swipe to dismiss and drag \&drop support to RecyclerView. |

*** ** * ** ***

A Listener interface that can be attached to a RecylcerView to get notified whenever a ViewHolder is attached to or detached from RecyclerView.

## Summary

| ### Public methods |
|---|---|
| `abstract void` | `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.OnChildAttachStateChangeListener#onChildViewAttachedToWindow(android.view.View)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/view/View.html view)` Called when a view is attached to the RecyclerView. |
| `abstract void` | `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.OnChildAttachStateChangeListener#onChildViewDetachedFromWindow(android.view.View)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/view/View.html view)` Called when a view is detached from RecyclerView. |

## Public methods

### onChildViewAttachedToWindow

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

```
abstract void onChildViewAttachedToWindow(@NonNull View view)
```

Called when a view is attached to the RecyclerView.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/view/View.html view` | The View which is attached to the RecyclerView |

### onChildViewDetachedFromWindow

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

```
abstract void onChildViewDetachedFromWindow(@NonNull View view)
```

Called when a view is detached from RecyclerView.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/view/View.html view` | The View which is being detached from the RecyclerView |