Android APIs
public static class

CoordinatorLayout.LayoutParams

extends ViewGroup.MarginLayoutParams
java.lang.Object
   ↳ android.view.ViewGroup.LayoutParams
     ↳ android.view.ViewGroup.MarginLayoutParams
       ↳ android.support.design.widget.CoordinatorLayout.LayoutParams

Class Overview

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

Summary

[Expand]
Inherited XML Attributes
From class android.view.ViewGroup.MarginLayoutParams
From class android.view.ViewGroup.LayoutParams
[Expand]
Inherited Constants
From class android.view.ViewGroup.LayoutParams
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 gravity A Gravity value describing how this child view should lay out.
public int keyline The index of the horizontal keyline specified to the parent CoordinatorLayout that this child should align relative to.
[Expand]
Inherited Fields
From class android.view.ViewGroup.MarginLayoutParams
From class android.view.ViewGroup.LayoutParams
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)
Get 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.
[Expand]
Inherited Methods
From class android.view.ViewGroup.MarginLayoutParams
From class android.view.ViewGroup.LayoutParams
From class java.lang.Object

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 gravity

A Gravity value describing how this child view should lay out. If an anchor is also specified, the gravity describes how this child view should be positioned relative to its anchored position.

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

public CoordinatorLayout.LayoutParams (int width, int height)

public CoordinatorLayout.LayoutParams (CoordinatorLayout.LayoutParams p)

public CoordinatorLayout.LayoutParams (ViewGroup.MarginLayoutParams p)

public CoordinatorLayout.LayoutParams (ViewGroup.LayoutParams p)

Public Methods

public int getAnchorId ()

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

Returns

public 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 setAnchorId (int id)

Get 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 NO_ID if there is no anchor

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 The behavior to set or null for no special behavior