CoordinatorLayout.LayoutParams

public class CoordinatorLayout.LayoutParams extends ViewGroup.MarginLayoutParams


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

Summary

Public fields

int

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

int

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

int

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

int

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

int

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

Public methods

@IdRes int

Get the id of this view's anchor.

@Nullable CoordinatorLayout.Behavior

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

void
setAnchorId(@IdRes int id)

Set the id of this view's anchor.

void

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

Inherited Constants

From android.view.ViewGroup.LayoutParams
static final int

This field is deprecated.

static final int
static final int

Inherited methods

From android.view.ViewGroup.LayoutParams
void
setBaseAttributes(TypedArray a, int widthAttr, int heightAttr)
From android.view.ViewGroup.MarginLayoutParams
int
int
int
boolean
void
resolveLayoutDirection(int layoutDirection)
void
setLayoutDirection(int layoutDirection)
void
setMarginEnd(int end)
void
setMarginStart(int start)
void
setMargins(int left, int top, int right, int bottom)

Public fields

anchorGravity

Added in 1.1.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 1.1.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 1.1.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 TOP or 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 1.1.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 1.1.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

LayoutParams

Added in 1.1.0
public LayoutParams(@NonNull CoordinatorLayout.LayoutParams p)

LayoutParams

Added in 1.1.0
public LayoutParams(@NonNull ViewGroup.LayoutParams p)

LayoutParams

Added in 1.1.0
public LayoutParams(@NonNull ViewGroup.MarginLayoutParams p)

LayoutParams

Added in 1.1.0
public LayoutParams(int width, int height)

Public methods

getAnchorId

Added in 1.1.0
public @IdRes int getAnchorId()

Get the id of this view's anchor.

Returns
@IdRes int

A view id or NO_ID if there is no anchor

getBehavior

Added in 1.1.0
public @Nullable CoordinatorLayout.Behavior getBehavior()

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

Returns
@Nullable CoordinatorLayout.Behavior

The current behavior or null if no behavior is specified

setAnchorId

Added in 1.1.0
public void setAnchorId(@IdRes 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
@IdRes int id

The view id of the anchor or NO_ID if there is no anchor

setBehavior

Added in 1.1.0
public void setBehavior(@Nullable 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
@Nullable CoordinatorLayout.Behavior behavior

The behavior to set or null for no special behavior