Save the date! Android Dev Summit is coming to Mountain View, CA on November 7-8, 2018.
added in version 1.0.0
belongs to Maven artifact androidx.coordinatorlayout:coordinatorlayout:1.1.0-alpha01

CoordinatorLayout.LayoutParams

public static class CoordinatorLayout.LayoutParams
extends ViewGroup.MarginLayoutParams

java.lang.Object
   ↳ android.view.ViewGroup.LayoutParams
     ↳ android.view.ViewGroup.MarginLayoutParams
       ↳ androidx.coordinatorlayout.widget.CoordinatorLayout.LayoutParams


Parameters describing the desired layout for a child of a CoordinatorLayout.

Summary

Inherited constants

Fields

public int anchorGravity

A Gravity value describing which edge of a child view's anchor view the child should position itself relative to.

public int dodgeInsetEdges

A Gravity value describing how this child view dodges any inset child views in the CoordinatorLayout.

public int gravity

A Gravity value describing how this child view should lay out.

public int insetEdge

A Gravity value describing how this child view insets the CoordinatorLayout.

public int keyline

The index of the horizontal keyline specified to the parent CoordinatorLayout that this child should align relative to.

Inherited fields

Public constructors

CoordinatorLayout.LayoutParams(int width, int height)
CoordinatorLayout.LayoutParams(CoordinatorLayout.LayoutParams p)
CoordinatorLayout.LayoutParams(ViewGroup.MarginLayoutParams p)
CoordinatorLayout.LayoutParams(ViewGroup.LayoutParams p)

Public methods

int getAnchorId()

Get the id of this view's anchor.

Behavior getBehavior()

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

void setAnchorId(int id)

Set the id of this view's anchor.

void setBehavior(Behavior behavior)

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

Inherited methods

Fields

anchorGravity

added in version 1.0.0
public int anchorGravity

A Gravity value describing which edge of a child view's anchor view the child should position itself relative to.

dodgeInsetEdges

added in version 1.0.0
public int dodgeInsetEdges

A Gravity 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 version 1.0.0
public int gravity

A Gravity 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 Gravity.TOP or GravityCompat.START. If an anchor is also specified, the gravity describes how this child view should be positioned relative to its anchored position.

insetEdge

added in version 1.0.0
public int insetEdge

A Gravity 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 version 1.0.0
public int keyline

The index of the horizontal keyline specified to the parent CoordinatorLayout that this child should align relative to. If an anchor is present the keyline will be ignored.

Public constructors

CoordinatorLayout.LayoutParams

added in version 1.0.0
public CoordinatorLayout.LayoutParams (int width, 
                int height)

Parameters
width int

height int

CoordinatorLayout.LayoutParams

added in version 1.0.0
public CoordinatorLayout.LayoutParams (CoordinatorLayout.LayoutParams p)

Parameters
p CoordinatorLayout.LayoutParams

CoordinatorLayout.LayoutParams

added in version 1.0.0
public CoordinatorLayout.LayoutParams (ViewGroup.MarginLayoutParams p)

Parameters
p ViewGroup.MarginLayoutParams

CoordinatorLayout.LayoutParams

added in version 1.0.0
public CoordinatorLayout.LayoutParams (ViewGroup.LayoutParams p)

Parameters
p ViewGroup.LayoutParams

Public methods

getAnchorId

added in version 1.0.0
public int getAnchorId ()

Get the id of this view's anchor.

Returns
int A view id or View.NO_ID if there is no anchor

getBehavior

added in version 1.0.0
public Behavior getBehavior ()

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

Returns
Behavior The current behavior or null if no behavior is specified

setAnchorId

added in version 1.0.0
public 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.

Parameters
id int: The view id of the anchor or View.NO_ID if there is no anchor

setBehavior

added in version 1.0.0
public 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.

Parameters
behavior Behavior: The behavior to set or null for no special behavior