Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# CoordinatorLayout.AttachedBehavior\n\nadded in [version 27.1.0](/topic/libraries/support-library/revisions) \nbelongs to Maven artifact com.android.support:coordinatorlayout:28.0.0-alpha1 \n\nCoordinatorLayout.AttachedBehavior\n==================================\n\n| This package is part of the Android [support library](/topic/libraries/support-library) which is no longer maintained. The support library has been superseded by [AndroidX](/jetpack/androidx) which is part of [Jetpack](/jetpack). We recommend using the AndroidX libraries in all new projects. You should also consider [migrating](/jetpack/androidx/migrate) existing projects to AndroidX. To find the AndroidX class that maps to this deprecated class, see the AndroidX support library [class\n| mappings](/jetpack/androidx/migrate/class-mappings).\n\n\n`\npublic\nstatic\n\n\ninterface\nCoordinatorLayout.AttachedBehavior\n`\n\n\n`\n\n\n`\n\n|------------------------------------------------------------------|\n| android.support.design.widget.CoordinatorLayout.AttachedBehavior |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nDefines the default attached [CoordinatorLayout.Behavior](/reference/android/support/design/widget/CoordinatorLayout.Behavior) of a [View](https://developer.android.com/reference/android/view/View.html) class\n\nWhen writing a custom view, implement this interface to return the default behavior\nwhen used as a direct child of an [CoordinatorLayout](/reference/android/support/design/widget/CoordinatorLayout). The default behavior\ncan be overridden using [setBehavior(CoordinatorLayout.Behavior)](/reference/android/support/design/widget/CoordinatorLayout.LayoutParams#setBehavior(android.support.design.widget.CoordinatorLayout.Behavior)).\n\n\u003cbr /\u003e\n\nSummary\n-------\n\n| ### Public methods ||\n|---------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` abstract `[Behavior](/reference/android/support/design/widget/CoordinatorLayout.Behavior) | ` `[getBehavior](/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. |\n\nPublic methods\n--------------\n\n### getBehavior\n\nadded in [version 27.1.0](/topic/libraries/support-library/revisions) \n\n```\nBehavior getBehavior ()\n```\n\nReturns the behavior associated with the matching [View](https://developer.android.com/reference/android/view/View.html) class.\n\n\u003cbr /\u003e\n\n| Returns ||\n|---------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------|\n| [Behavior](/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. \u003cbr /\u003e |\n\n-\n\n Annotations\n -----------\n\n - [CoordinatorLayout.DefaultBehavior](/reference/android/support/design/widget/CoordinatorLayout.DefaultBehavior)\n-\n\n Interfaces\n ----------\n\n - [CoordinatorLayout.AttachedBehavior](/reference/android/support/design/widget/CoordinatorLayout.AttachedBehavior)\n-\n\n Classes\n -------\n\n - [CoordinatorLayout](/reference/android/support/design/widget/CoordinatorLayout)\n - [CoordinatorLayout.Behavior](/reference/android/support/design/widget/CoordinatorLayout.Behavior)\n - [CoordinatorLayout.LayoutParams](/reference/android/support/design/widget/CoordinatorLayout.LayoutParams)\n - [CoordinatorLayout.SavedState](/reference/android/support/design/widget/CoordinatorLayout.SavedState)"]]