# CoordinatorLayout.LayoutParams

# CoordinatorLayout.LayoutParams

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.LayoutParams)  
Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/coordinatorlayout#1.1.0)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/coordinatorlayout/widget/CoordinatorLayout.LayoutParams "View this page in Java")

<br />

```
class CoordinatorLayout.LayoutParams : ViewGroup.MarginLayoutParams
```

<br />

|---|---|---|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [kotlin.Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html)                                                                                                           ||||
| ↳ | [android.view.ViewGroup.LayoutParams](https://developer.android.com/reference/android/view/ViewGroup.LayoutParams.html)                                                                   |||
|   | ↳ | [android.view.ViewGroup.MarginLayoutParams](https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams.html)                                                    ||
|   |   | ↳ | [androidx.coordinatorlayout.widget.CoordinatorLayout.LayoutParams](https://developer.android.com/reference/kotlin/androidx/coordinatorlayout/widget/CoordinatorLayout.LayoutParams) |

*** ** * ** ***

Parameters describing the desired layout for a child of a[CoordinatorLayout](https://developer.android.com/reference/kotlin/androidx/coordinatorlayout/widget/CoordinatorLayout).

## Summary

|                                                                                                                                                                         ### Public constructors                                                                                                                                                                          |
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [LayoutParams](https://developer.android.com/reference/kotlin/androidx/coordinatorlayout/widget/CoordinatorLayout.LayoutParams#LayoutParams(androidx.coordinatorlayout.widget.CoordinatorLayout.LayoutParams))`(p: `[CoordinatorLayout.LayoutParams](https://developer.android.com/reference/kotlin/androidx/coordinatorlayout/widget/CoordinatorLayout.LayoutParams)`)` |
| [LayoutParams](https://developer.android.com/reference/kotlin/androidx/coordinatorlayout/widget/CoordinatorLayout.LayoutParams#LayoutParams(android.view.ViewGroup.LayoutParams))`(p: `[ViewGroup.LayoutParams](https://developer.android.com/reference/android/view/ViewGroup.LayoutParams.html)`)`                                                                     |
| [LayoutParams](https://developer.android.com/reference/kotlin/androidx/coordinatorlayout/widget/CoordinatorLayout.LayoutParams#LayoutParams(android.view.ViewGroup.MarginLayoutParams))`(p: `[ViewGroup.MarginLayoutParams](https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams.html)`)`                                                   |
| [LayoutParams](https://developer.android.com/reference/kotlin/androidx/coordinatorlayout/widget/CoordinatorLayout.LayoutParams#LayoutParams(int,int))`(width: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`, height: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)`                                     |

|                                                                        ### Public functions                                                                        |
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `@`[IdRes](https://developer.android.com/reference/kotlin/androidx/annotation/IdRes)` `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [getAnchorId](https://developer.android.com/reference/kotlin/androidx/coordinatorlayout/widget/CoordinatorLayout.LayoutParams#getAnchorId())`()` Get the id of this view's anchor.                                                                                                                                                                                                                                                                                            |
| [CoordinatorLayout.Behavior](https://developer.android.com/reference/kotlin/androidx/coordinatorlayout/widget/CoordinatorLayout.Behavior)`?`                       | [getBehavior](https://developer.android.com/reference/kotlin/androidx/coordinatorlayout/widget/CoordinatorLayout.LayoutParams#getBehavior())`()` Get the behavior governing the layout and interaction of the child view within a parent CoordinatorLayout.                                                                                                                                                                                                                   |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)                                                                                      | [setAnchorId](https://developer.android.com/reference/kotlin/androidx/coordinatorlayout/widget/CoordinatorLayout.LayoutParams#setAnchorId(int))`(id: @`[IdRes](https://developer.android.com/reference/kotlin/androidx/annotation/IdRes)` `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` Set the id of this view's anchor.                                                                                                                   |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)                                                                                      | [setBehavior](https://developer.android.com/reference/kotlin/androidx/coordinatorlayout/widget/CoordinatorLayout.LayoutParams#setBehavior(androidx.coordinatorlayout.widget.CoordinatorLayout.Behavior))`(behavior: `[CoordinatorLayout.Behavior](https://developer.android.com/reference/kotlin/androidx/coordinatorlayout/widget/CoordinatorLayout.Behavior)`?)` Set the behavior governing the layout and interaction of the child view within a parent CoordinatorLayout. |

|                            ### Public properties                            |
|-----------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [anchorGravity](https://developer.android.com/reference/kotlin/androidx/coordinatorlayout/widget/CoordinatorLayout.LayoutParams#anchorGravity()) A[Gravity](https://developer.android.com/reference/android/view/Gravity.html)value describing which edge of a child view's[anchor](https://developer.android.com/reference/kotlin/androidx/coordinatorlayout/widget/CoordinatorLayout.LayoutParams#getAnchorId())view the child should position itself relative to. |
| [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [dodgeInsetEdges](https://developer.android.com/reference/kotlin/androidx/coordinatorlayout/widget/CoordinatorLayout.LayoutParams#dodgeInsetEdges()) A[Gravity](https://developer.android.com/reference/android/view/Gravity.html)value describing how this child view dodges any inset child views in the CoordinatorLayout.                                                                                                                                        |
| [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [gravity](https://developer.android.com/reference/kotlin/androidx/coordinatorlayout/widget/CoordinatorLayout.LayoutParams#gravity()) A[Gravity](https://developer.android.com/reference/android/view/Gravity.html)value describing how this child view should lay out.                                                                                                                                                                                               |
| [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [insetEdge](https://developer.android.com/reference/kotlin/androidx/coordinatorlayout/widget/CoordinatorLayout.LayoutParams#insetEdge()) A[Gravity](https://developer.android.com/reference/android/view/Gravity.html)value describing how this child view insets the CoordinatorLayout.                                                                                                                                                                             |
| [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [keyline](https://developer.android.com/reference/kotlin/androidx/coordinatorlayout/widget/CoordinatorLayout.LayoutParams#keyline()) The index of the horizontal keyline specified to the parent CoordinatorLayout that this child should align relative to.                                                                                                                                                                                                         |

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   ### Inherited Constants                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| From[android.view.ViewGroup.LayoutParams](https://developer.android.com/reference/android/view/ViewGroup.LayoutParams.html) |-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------| | `const `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [FILL_PARENT](https://developer.android.com/reference/android/view/ViewGroup.LayoutParams.html#FILL_PARENT())` = -1` **This property is deprecated.** | | `const `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [MATCH_PARENT](https://developer.android.com/reference/android/view/ViewGroup.LayoutParams.html#MATCH_PARENT())` = -1`                                | | `const `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [WRAP_CONTENT](https://developer.android.com/reference/android/view/ViewGroup.LayoutParams.html#WRAP_CONTENT())` = -2`                                | |

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       ### Inherited functions                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| From[android.view.ViewGroup.LayoutParams](https://developer.android.com/reference/android/view/ViewGroup.LayoutParams.html) |-------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [setBaseAttributes](https://developer.android.com/reference/android/view/ViewGroup.LayoutParams.html#setBaseAttributes(android.content.res.TypedArray, int, int))`(a: `[TypedArray](https://developer.android.com/reference/android/content/res/TypedArray.html)`!, widthAttr: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`, heightAttr: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| From[android.view.ViewGroup.MarginLayoutParams](https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams.html) |-------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)         | [getLayoutDirection](https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams.html#getLayoutDirection())`()`                                                                                                                                                                                                                                                                                                                                                       | | [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)         | [getMarginEnd](https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams.html#getMarginEnd())`()`                                                                                                                                                                                                                                                                                                                                                                   | | [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)         | [getMarginStart](https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams.html#getMarginStart())`()`                                                                                                                                                                                                                                                                                                                                                               | | [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | [isMarginRelative](https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams.html#isMarginRelative())`()`                                                                                                                                                                                                                                                                                                                                                           | | [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)       | [resolveLayoutDirection](https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams.html#resolveLayoutDirection(int))`(layoutDirection: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)`                                                                                                                                                                                                                                              | | [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)       | [setLayoutDirection](https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams.html#setLayoutDirection(int))`(layoutDirection: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)`                                                                                                                                                                                                                                                      | | [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)       | [setMarginEnd](https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams.html#setMarginEnd(int))`(end: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)`                                                                                                                                                                                                                                                                              | | [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)       | [setMarginStart](https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams.html#setMarginStart(int))`(start: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)`                                                                                                                                                                                                                                                                        | | [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)       | [setMargins](https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams.html#setMargins(int, int, int, int))`(left: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`, top: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`, right: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`, bottom: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` | |

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              ### Inherited properties                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| From[android.view.ViewGroup.LayoutParams](https://developer.android.com/reference/android/view/ViewGroup.LayoutParams.html) |-----------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------| | [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)                                                                                           | [height](https://developer.android.com/reference/android/view/ViewGroup.LayoutParams.html#height())                                       | | [LayoutAnimationController.AnimationParameters](https://developer.android.com/reference/android/view/animation/LayoutAnimationController.AnimationParameters.html)`!` | [layoutAnimationParameters](https://developer.android.com/reference/android/view/ViewGroup.LayoutParams.html#layoutAnimationParameters()) | | [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)                                                                                           | [width](https://developer.android.com/reference/android/view/ViewGroup.LayoutParams.html#width())                                         | |
| From[android.view.ViewGroup.MarginLayoutParams](https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams.html) |-----------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------| | [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [bottomMargin](https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams.html#bottomMargin()) | | [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [leftMargin](https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams.html#leftMargin())     | | [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [rightMargin](https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams.html#rightMargin())   | | [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [topMargin](https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams.html#topMargin())       |                                                                                                                                                                                                                                     |

## Public constructors

### LayoutParams

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

```
LayoutParams(p: CoordinatorLayout.LayoutParams)
```  

### LayoutParams

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

```
LayoutParams(p: ViewGroup.LayoutParams)
```  

### LayoutParams

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

```
LayoutParams(p: ViewGroup.MarginLayoutParams)
```  

### LayoutParams

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

```
LayoutParams(width: Int, height: Int)
```  

## Public functions

### getAnchorId

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

```
fun getAnchorId(): @IdRes Int
```

Get the id of this view's anchor.  

|                                                                              Returns                                                                               |
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `@`[IdRes](https://developer.android.com/reference/kotlin/androidx/annotation/IdRes)` `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | A[view id](https://developer.android.com/reference/android/view/View.html#getId())or[NO_ID](https://developer.android.com/reference/android/view/View.html#NO_ID())if there is no anchor |

### getBehavior

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

```
fun getBehavior(): CoordinatorLayout.Behavior?
```

Get the behavior governing the layout and interaction of the child view within a parent CoordinatorLayout.  

|                                                                   Returns                                                                    |
|----------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------|
| [CoordinatorLayout.Behavior](https://developer.android.com/reference/kotlin/androidx/coordinatorlayout/widget/CoordinatorLayout.Behavior)`?` | The current behavior or null if no behavior is specified |

### setAnchorId

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

```
fun setAnchorId(id: @IdRes Int): Unit
```

Set the id of this view's anchor.

The view with this id must be a descendant of the CoordinatorLayout containing the child view this LayoutParams belongs to. It may not be the child view with this LayoutParams or a descendant of it.  

|                                                                               Parameters                                                                               |
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `id: @`[IdRes](https://developer.android.com/reference/kotlin/androidx/annotation/IdRes)` `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | The[view id](https://developer.android.com/reference/android/view/View.html#getId())of the anchor or[NO_ID](https://developer.android.com/reference/android/view/View.html#NO_ID())if there is no anchor |

### setBehavior

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

```
fun setBehavior(behavior: CoordinatorLayout.Behavior?): Unit
```

Set the behavior governing the layout and interaction of the child view within a parent CoordinatorLayout.

Setting a new behavior will remove any currently associated[Behavior tag](https://developer.android.com/reference/kotlin/androidx/coordinatorlayout/widget/CoordinatorLayout.Behavior#setTag(android.view.View,java.lang.Object)).  

|                                                                        Parameters                                                                        |
|----------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------|
| `behavior: `[CoordinatorLayout.Behavior](https://developer.android.com/reference/kotlin/androidx/coordinatorlayout/widget/CoordinatorLayout.Behavior)`?` | The behavior to set or null for no special behavior |

## Public properties

### anchorGravity

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

```
val anchorGravity: Int
```

A[Gravity](https://developer.android.com/reference/android/view/Gravity.html)value describing which edge of a child view's[anchor](https://developer.android.com/reference/kotlin/androidx/coordinatorlayout/widget/CoordinatorLayout.LayoutParams#getAnchorId())view the child should position itself relative to.  

### dodgeInsetEdges

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

```
val dodgeInsetEdges: Int
```

A[Gravity](https://developer.android.com/reference/android/view/Gravity.html)value describing how this child view dodges any inset child views in the CoordinatorLayout. Any views which are inset on the same edge as this view is set to dodge will result in this view being moved so that the views do not overlap.  

### gravity

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

```
val gravity: Int
```

A[Gravity](https://developer.android.com/reference/android/view/Gravity.html)value describing how this child view should lay out. If either or both of the axes are not specified, they are treated by CoordinatorLayout as[TOP](https://developer.android.com/reference/android/view/Gravity.html#TOP())or[START](https://developer.android.com/reference/kotlin/androidx/core/view/GravityCompat#START()). If an[anchor](https://developer.android.com/reference/kotlin/androidx/coordinatorlayout/widget/CoordinatorLayout.LayoutParams#setAnchorId(int))is also specified, the gravity describes how this child view should be positioned relative to its anchored position.  

### insetEdge

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

```
val insetEdge: Int
```

A[Gravity](https://developer.android.com/reference/android/view/Gravity.html)value describing how this child view insets the CoordinatorLayout. Other child views which are set to dodge the same inset edges will be moved appropriately so that the views do not overlap.  

### keyline

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

```
val keyline: Int
```

The index of the horizontal keyline specified to the parent CoordinatorLayout that this child should align relative to. If an[anchor](https://developer.android.com/reference/kotlin/androidx/coordinatorlayout/widget/CoordinatorLayout.LayoutParams#setAnchorId(int))is present the keyline will be ignored.