Class CoordinatorLayout.LayoutParams

Enclosing class:
CoordinatorLayout

public static class CoordinatorLayout.LayoutParams extends ViewGroup.MarginLayoutParams
Parameters describing the desired layout for a child of a CoordinatorLayout.
  • Field Details

    • gravity

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

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

      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.
    • dodgeInsetEdges

      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.
  • Constructor Details

  • Method Details

    • getAnchorId

      public int getAnchorId()
      Get the id of this view's anchor.
      Returns:
      A view id or View.NO_ID if there is no anchor
    • setAnchorId

      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.NO_ID if there is no anchor
    • getBehavior

      @Nullable public <V extends View> CoordinatorLayout.Behavior<V> 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
    • setBehavior

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