# CoordinatorLayout.AttachedBehavior

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

*** ** * ** ***


```
public interface CoordinatorLayout.AttachedBehavior
```

<br />

*** ** * ** ***

Defines the default attached `https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout.Behavior` of a `https://developer.android.com/reference/android/view/View.html` class

When writing a custom view, implement this interface to return the default behavior when used as a direct child of an `https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout`. The default behavior can be overridden using `https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout.LayoutParams#setBehavior(androidx.coordinatorlayout.widget.CoordinatorLayout.Behavior)`.

## Summary

| ### Public methods |
|---|---|
| `abstract @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout.Behavior` | `https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout.AttachedBehavior#getBehavior()()` Returns the behavior associated with the matching `https://developer.android.com/reference/android/view/View.html` class. |

## Public methods

### getBehavior

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

```
abstract @NonNull CoordinatorLayout.Behavior getBehavior()
```

Returns the behavior associated with the matching `https://developer.android.com/reference/android/view/View.html` class.

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout.Behavior` | The behavior associated with the matching `https://developer.android.com/reference/android/view/View.html` class. Must be non-null. |