# CoordinatorLayout.AttachedBehavior

added in[version 27.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  
belongs to Maven artifact com.android.support:coordinatorlayout:28.0.0-alpha1  

# CoordinatorLayout.AttachedBehavior

| This package is part of the Android[support library](https://developer.android.com/topic/libraries/support-library)which is no longer maintained. The support library has been superseded by[AndroidX](https://developer.android.com/jetpack/androidx)which is part of[Jetpack](https://developer.android.com/jetpack). We recommend using the AndroidX libraries in all new projects. You should also consider[migrating](https://developer.android.com/jetpack/androidx/migrate)existing projects to AndroidX. To find the AndroidX class that maps to this deprecated class, see the AndroidX support library[class mappings](https://developer.android.com/jetpack/androidx/migrate/class-mappings).

`
public
static


interface
CoordinatorLayout.AttachedBehavior
`  
`


`

|------------------------------------------------------------------|
| android.support.design.widget.CoordinatorLayout.AttachedBehavior |

<br />

*** ** * ** ***

Defines the default attached[CoordinatorLayout.Behavior](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.Behavior)of a[View](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[CoordinatorLayout](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout). The default behavior can be overridden using[setBehavior(CoordinatorLayout.Behavior)](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.LayoutParams#setBehavior(android.support.design.widget.CoordinatorLayout.Behavior)).

<br />

## Summary

|                                                                                                                                                                                          ### Public methods                                                                                                                                                                                           ||
|--------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` abstract `[Behavior](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.Behavior) | ` `[getBehavior](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.AttachedBehavior#getBehavior())`() ` Returns the behavior associated with the matching[View](https://developer.android.com/reference/android/view/View.html)class. |

## Public methods

### getBehavior

added in[version 27.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
Behavior getBehavior ()
```

Returns the behavior associated with the matching[View](https://developer.android.com/reference/android/view/View.html)class.

<br />

|                                                                                                                           Returns                                                                                                                            ||
|--------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------|
| [Behavior](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.Behavior) | The behavior associated with the matching[View](https://developer.android.com/reference/android/view/View.html)class. Must be non-null. <br /> |

-

  ## Annotations

  - [CoordinatorLayout.DefaultBehavior](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.DefaultBehavior)
-

  ## Interfaces

  - [CoordinatorLayout.AttachedBehavior](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.AttachedBehavior)
-

  ## Classes

  - [CoordinatorLayout](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout)
  - [CoordinatorLayout.Behavior](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.Behavior)
  - [CoordinatorLayout.LayoutParams](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.LayoutParams)
  - [CoordinatorLayout.SavedState](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.SavedState)