CoordinatorLayout.LayoutParams


class CoordinatorLayout.LayoutParams : ViewGroup.MarginLayoutParams


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

Summary

Public functions

@IdRes Int

Get the id of this view's anchor.

CoordinatorLayout.Behavior?

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

Unit

Set the id of this view's anchor.

Unit

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

Public properties

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.

Inherited Constants

From android.view.ViewGroup.LayoutParams
const Int

This property is deprecated.

const Int
const Int

Public constructors

LayoutParams

Added in 1.1.0
LayoutParams(p: ViewGroup.LayoutParams)

LayoutParams

Added in 1.1.0
LayoutParams(p: ViewGroup.MarginLayoutParams)

LayoutParams

Added in 1.1.0
LayoutParams(width: Int, height: Int)

Public functions

getAnchorId

Added in 1.1.0
fun getAnchorId(): @IdRes Int

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
fun getBehavior(): CoordinatorLayout.Behavior?

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

Returns
CoordinatorLayout.Behavior?

The current behavior or null if no behavior is specified

setAnchorId

Added in 1.1.0
fun setAnchorId(id: @IdRes Int): Unit

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: @IdRes Int

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

setBehavior

Added in 1.1.0
fun setBehavior(behavior: CoordinatorLayout.Behavior?): Unit

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: CoordinatorLayout.Behavior?

The behavior to set or null for no special behavior

Public properties

anchorGravity

Added in 1.1.0
val anchorGravityInt

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
val dodgeInsetEdgesInt

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
val gravityInt

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
val insetEdgeInt

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
val keylineInt

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.