# CoordinatorLayout.LayoutParams

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  
belongs to Maven artifact com.android.support:coordinatorlayout:28.0.0-alpha1  
Summary:[Inherited Constants](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.LayoutParams#inhconstants)\|[Fields](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.LayoutParams#lfields)\|[Inherited Fields](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.LayoutParams#inhfields)\|[Ctors](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.LayoutParams#pubctors)\|[Methods](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.LayoutParams#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.LayoutParams#inhmethods)\|[\[Expand All\]](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.LayoutParams#)  

# CoordinatorLayout.LayoutParams

| 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


class
CoordinatorLayout.LayoutParams
`  
`


``


``

extends `[ViewGroup.MarginLayoutParams](https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams.html)`


``


`

|---|---|---|--------------------------------------------------------------|
| java.lang.Object                                                      ||||
| ↳ | [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) ||
|   |   | ↳ | android.support.design.widget.CoordinatorLayout.LayoutParams |

<br />

*** ** * ** ***

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

## Summary

|                                                                                                                                                                               ### Inherited constants                                                                                                                                                                                |
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.LayoutParams#)From class` android.view.ViewGroup.LayoutParams ` |-------|-----------------------| | `int` | `FILL_PARENT` <br />  | | `int` | `MATCH_PARENT` <br /> | | `int` | `WRAP_CONTENT` <br /> | |

|                                                                                                                                                                                                                         ### Fields                                                                                                                                                                                                                          ||
|---------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` public int` | [anchorGravity](https://developer.android.com/reference/android/support/design/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/android/support/design/widget/CoordinatorLayout.LayoutParams#getAnchorId())view the child should position itself relative to. |
| ` public int` | [dodgeInsetEdges](https://developer.android.com/reference/android/support/design/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.                                                                                                                             |
| ` public int` | [gravity](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.LayoutParams#gravity) A[Gravity](https://developer.android.com/reference/android/view/Gravity.html)value describing how this child view should lay out.                                                                                                                                                                                    |
| ` public int` | [insetEdge](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.LayoutParams#insetEdge) A[Gravity](https://developer.android.com/reference/android/view/Gravity.html)value describing how this child view insets the CoordinatorLayout.                                                                                                                                                                  |
| ` public int` | [keyline](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.LayoutParams#keyline) The index of the horizontal keyline specified to the parent CoordinatorLayout that this child should align relative to.                                                                                                                                                                                              |

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         ### Inherited fields                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.LayoutParams#)From class` android.view.ViewGroup.MarginLayoutParams ` |---------------|-----------------------| | ` public int` | `bottomMargin` <br /> | | ` public int` | `leftMargin` <br />   | | ` public int` | `rightMargin` <br />  | | ` public int` | `topMargin` <br />    |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.LayoutParams#)From class` android.view.ViewGroup.LayoutParams ` |------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------| | ` public int`                                                                                                                                                                | `height` <br />                    | | ` public `[LayoutAnimationController.AnimationParameters](https://developer.android.com/reference/android/view/animation/LayoutAnimationController.AnimationParameters.html) | `layoutAnimationParameters` <br /> | | ` public int`                                                                                                                                                                | `width` <br />                     | |

|                                                                                                                                                                                 ### Public constructors                                                                                                                                                                                  ||
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| ` `[CoordinatorLayout.LayoutParams](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.LayoutParams#CoordinatorLayout.LayoutParams(int, int))`(int width, int height) `                                                                                                                                                                          |
| ` `[CoordinatorLayout.LayoutParams](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.LayoutParams#CoordinatorLayout.LayoutParams(android.support.design.widget.CoordinatorLayout.LayoutParams))`(`[CoordinatorLayout.LayoutParams](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.LayoutParams)` p) ` |
| ` `[CoordinatorLayout.LayoutParams](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.LayoutParams#CoordinatorLayout.LayoutParams(android.view.ViewGroup.MarginLayoutParams))`(`[ViewGroup.MarginLayoutParams](https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams.html)` p) `                                    |
| ` `[CoordinatorLayout.LayoutParams](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.LayoutParams#CoordinatorLayout.LayoutParams(android.view.ViewGroup.LayoutParams))`(`[ViewGroup.LayoutParams](https://developer.android.com/reference/android/view/ViewGroup.LayoutParams.html)` p) `                                                      |

|                                                                                                                                                                                                                                                                  ### Public methods                                                                                                                                                                                                                                                                  ||
|-----------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` int`                                                                                                          | ` `[getAnchorId](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.LayoutParams#getAnchorId())`() ` Get the id of this view's anchor.                                                                                                                                                                                                                                                         |
| ` `[Behavior](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.Behavior) | ` `[getBehavior](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.LayoutParams#getBehavior())`() ` Get the behavior governing the layout and interaction of the child view within a parent CoordinatorLayout.                                                                                                                                                                                |
| ` void`                                                                                                         | ` `[setAnchorId](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.LayoutParams#setAnchorId(int))`(int id) ` Set the id of this view's anchor.                                                                                                                                                                                                                                                |
| ` void`                                                                                                         | ` `[setBehavior](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.LayoutParams#setBehavior(android.support.design.widget.CoordinatorLayout.Behavior))`(`[Behavior](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.Behavior)` behavior) ` Set the behavior governing the layout and interaction of the child view within a parent CoordinatorLayout. |

| ### Inherited methods |
|-----------------------|---|
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.LayoutParams#)From class` `[android.view.ViewGroup.MarginLayoutParams](https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams.html)` ` |------------|--------------------------------------------------------| | ` int`     | ` getLayoutDirection() `                               | | ` int`     | ` getMarginEnd() `                                     | | ` int`     | ` getMarginStart() `                                   | | ` boolean` | ` isMarginRelative() `                                 | | ` void`    | ` resolveLayoutDirection(int arg0) `                   | | ` void`    | ` setLayoutDirection(int arg0) `                       | | ` void`    | ` setMarginEnd(int arg0) `                             | | ` void`    | ` setMarginStart(int arg0) `                           | | ` void`    | ` setMargins(int arg0, int arg1, int arg2, int arg3) ` | ||
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.LayoutParams#)From class` `[android.view.ViewGroup.LayoutParams](https://developer.android.com/reference/android/view/ViewGroup.LayoutParams.html)` ` |---------|---------------------------------------------------------------------------------------------------------------------------------------------| | ` void` | ` resolveLayoutDirection(int arg0) `                                                                                                        | | ` void` | ` setBaseAttributes(`[TypedArray](https://developer.android.com/reference/android/content/res/TypedArray.html)` arg0, int arg1, int arg2) ` | ||
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.LayoutParams#)From class` java.lang.Object ` |-------------------|-------------------------------| | ` Object`         | ` clone() `                   | | ` boolean`        | ` equals(Object arg0) `       | | ` void`           | ` finalize() `                | | ` final Class<?>` | ` getClass() `                | | ` int`            | ` hashCode() `                | | ` final void`     | ` notify() `                  | | ` final void`     | ` notifyAll() `               | | ` String`         | ` toString() `                | | ` final void`     | ` wait(long arg0, int arg1) ` | | ` final void`     | ` wait(long arg0) `           | | ` final void`     | ` wait() `                    | ||

## Fields

### anchorGravity

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

```
int 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/android/support/design/widget/CoordinatorLayout.LayoutParams#getAnchorId())view the child should position itself relative to.

<br />

### dodgeInsetEdges

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

```
int 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. 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.

<br />

### gravity

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

```
int gravity
```

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/android/support/v4/view/GravityCompat#START). If an[anchor](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.LayoutParams#setAnchorId(int))is also specified, the gravity describes how this child view should be positioned relative to its anchored position.

<br />

### insetEdge

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

```
int insetEdge
```

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.

<br />

### keyline

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

```
int keyline
```

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/android/support/design/widget/CoordinatorLayout.LayoutParams#setAnchorId(int))is present the keyline will be ignored.

<br />

## Public constructors

### CoordinatorLayout.LayoutParams

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

```
CoordinatorLayout.LayoutParams (int width, 
                int height)
```

<br />

<br />

|       Parameters       ||
|----------|--------------|
| `width`  | `int` <br /> |
| `height` | `int` <br /> |

### CoordinatorLayout.LayoutParams

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

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

<br />

<br />

|                  Parameters                  ||
|-----|-----------------------------------------|
| `p` | `CoordinatorLayout.LayoutParams` <br /> |

### CoordinatorLayout.LayoutParams

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

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

<br />

<br />

|                 Parameters                 ||
|-----|---------------------------------------|
| `p` | `ViewGroup.MarginLayoutParams` <br /> |

### CoordinatorLayout.LayoutParams

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

```
CoordinatorLayout.LayoutParams (ViewGroup.LayoutParams p)
```

<br />

<br />

|              Parameters              ||
|-----|---------------------------------|
| `p` | `ViewGroup.LayoutParams` <br /> |

## Public methods

### getAnchorId

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

```
int getAnchorId ()
```

Get the id of this view's anchor.

<br />

|                                                                                               Returns                                                                                                ||
|-------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `int` | 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 <br /> |

### getBehavior

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

```
Behavior getBehavior ()
```

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

<br />

|                                                                                    Returns                                                                                    ||
|--------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------|
| [Behavior](https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.Behavior) | The current behavior or null if no behavior is specified <br /> |

### setAnchorId

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

```
void setAnchorId (int id)
```

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.

<br />

<br />

|                                                                                                         Parameters                                                                                                         ||
|------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `id` | `int`: 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 <br /> |

### setBehavior

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

```
void setBehavior (Behavior behavior)
```

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/android/support/design/widget/CoordinatorLayout.Behavior#setTag(android.view.View, java.lang.Object)).

<br />

<br />

|                                     Parameters                                     ||
|------------|------------------------------------------------------------------------|
| `behavior` | `Behavior`: The behavior to set or null for no special behavior <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)