public class

CoordinatorLayout.LayoutParams

extends MarginLayoutParams

 java.lang.Object

↳MarginLayoutParams

↳androidx.coordinatorlayout.widget.CoordinatorLayout.LayoutParams

Overview

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

Summary

Fields
public intanchorGravity

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

public intdodgeInsetEdges

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

public intgravity

A value describing how this child view should lay out.

public intinsetEdge

A value describing how this child view insets the CoordinatorLayout.

public intkeyline

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

Constructors
publicLayoutParams(CoordinatorLayout.LayoutParams p)

publicLayoutParams(int width, int height)

publicLayoutParams(MarginLayoutParams p)

publicLayoutParams(ViewGroup.LayoutParams p)

Methods
public intgetAnchorId()

Get the id of this view's anchor.

public CoordinatorLayout.BehaviorgetBehavior()

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

public voidsetAnchorId(int id)

Set the id of this view's anchor.

public voidsetBehavior(CoordinatorLayout.Behavior behavior)

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

from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Fields

public int gravity

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

public int anchorGravity

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

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 int insetEdge

A 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.

public int dodgeInsetEdges

A 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.

Constructors

public LayoutParams(int width, int height)

public LayoutParams(CoordinatorLayout.LayoutParams p)

public LayoutParams(MarginLayoutParams p)

public LayoutParams(ViewGroup.LayoutParams p)

Methods

public int getAnchorId()

Get the id of this view's anchor.

Returns:

A view id or View if there is no anchor

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: The view id of the anchor or View if there is no anchor

public CoordinatorLayout.Behavior getBehavior()

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

Returns:

The current behavior or null if no behavior is specified

public void setBehavior(CoordinatorLayout.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: The behavior to set or null for no special behavior