CoordinatorLayout

(SESL variant) CoordinatorLayout is a super-powered FrameLayout.

CoordinatorLayout is intended for two primary use cases:

  1. As a top-level application decor or chrome layout
  2. As a container for a specific interaction with one or more child views

By specifying Behaviors for child views of a CoordinatorLayout you can provide many different interactions within a single parent and those views can also interact with one another. View classes can specify a default behavior when used as a child of a CoordinatorLayout by implementing the AttachedBehavior interface.

Behaviors may be used to implement a variety of interactions and additional layout modifications ranging from sliding drawers and panels to swipe-dismissable elements and buttons that stick to other elements as they move and animate.

Children of a CoordinatorLayout may have an anchor. This view id must correspond to an arbitrary descendant of the CoordinatorLayout, but it may not be the anchored child itself or a descendant of the anchored child. This can be used to place floating views relative to other arbitrary content panes.

Children can specify insetEdge to describe how the view insets the CoordinatorLayout. Any child views which are set to dodge the same inset edges by dodgeInsetEdges will be moved appropriately so that the views do not overlap.

Constructors

Link copied to clipboard
constructor(@NonNull context: @NonNull Context)
constructor(@NonNull context: @NonNull Context, @Nullable attrs: @Nullable AttributeSet)
constructor(@NonNull context: @NonNull Context, @Nullable attrs: @Nullable AttributeSet, @AttrRes defStyleAttr: Int)

Types

Link copied to clipboard
Defines the default attached Behavior of a View class When writing a custom view, implement this interface to return the default behavior when used as a direct child of an CoordinatorLayout.
Link copied to clipboard
abstract class Behavior<V : View?>
Interaction behavior plugin for child views of CoordinatorLayout.
Link copied to clipboard
Defines the default Behavior of a View class.
Link copied to clipboard
Link copied to clipboard
Parameters describing the desired layout for a child of a CoordinatorLayout.

Functions

Link copied to clipboard
open fun dispatchDependentViewsChanged(@NonNull view: @NonNull View)
Allows the caller to manually dispatch onDependentViewChanged to the associated Behavior instances of views which depend on the provided View.
Link copied to clipboard
Link copied to clipboard
open fun dispatchKeyEvent(@NonNull event: @NonNull KeyEvent): Boolean
Link copied to clipboard
open fun doViewsOverlap(@NonNull first: @NonNull View, @NonNull second: @NonNull View): Boolean
Check whether two views overlap each other.
Link copied to clipboard
@NonNull
open fun getDependencies(@NonNull child: @NonNull View): @NonNull List<View>
Returns a new list containing the views on which the provided view depends.
Link copied to clipboard
@NonNull
open fun getDependents(@NonNull child: @NonNull View): @NonNull List<View>
Returns a new list of views which depend on the provided view.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
@Nullable
open fun getStatusBarBackground(): @Nullable Drawable
Gets the drawable used to draw in the insets area for the status bar.
Link copied to clipboard
open fun isPointInChildBounds(@NonNull child: @NonNull View, x: Int, y: Int): Boolean
Check if a given point in the CoordinatorLayout's coordinates are within the view bounds of the given direct child view.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun onDraw(@NonNull c: @NonNull Canvas)
Link copied to clipboard
Link copied to clipboard
open fun onLayoutChild(@NonNull child: @NonNull View, layoutDirection: Int)
Called to lay out each individual child view unless a Behavior is present.
Link copied to clipboard
open fun onMeasureChild(@NonNull child: @NonNull View, parentWidthMeasureSpec: Int, widthUsed: Int, parentHeightMeasureSpec: Int, heightUsed: Int)
Called to measure each individual child view unless a Behavior is present.
Link copied to clipboard
open fun onNestedFling(target: View, velocityX: Float, velocityY: Float, consumed: Boolean): Boolean
Link copied to clipboard
open fun onNestedPreFling(target: View, velocityX: Float, velocityY: Float): Boolean
Link copied to clipboard
open fun onNestedPreScroll(@NonNull target: @NonNull View, dx: Int, dy: Int, consumed: @NonNull Array<Int>)
open fun onNestedPreScroll(@NonNull target: @NonNull View, dx: Int, dy: Int, consumed: @NonNull Array<Int>, type: Int)
Link copied to clipboard
open fun onNestedScroll(@NonNull target: @NonNull View, dxConsumed: Int, dyConsumed: Int, dxUnconsumed: Int, dyUnconsumed: Int)
open fun onNestedScroll(@NonNull target: @NonNull View, dxConsumed: Int, dyConsumed: Int, dxUnconsumed: Int, dyUnconsumed: Int, type: Int)
open fun onNestedScroll(@NonNull target: @NonNull View, dxConsumed: Int, dyConsumed: Int, dxUnconsumed: Int, dyUnconsumed: Int, type: Int, consumed: @NonNull Array<Int>)
Link copied to clipboard
open fun onNestedScrollAccepted(@NonNull child: @NonNull View, @NonNull target: @NonNull View, axes: Int)
open fun onNestedScrollAccepted(@NonNull child: @NonNull View, @NonNull target: @NonNull View, axes: Int, type: Int)
Link copied to clipboard
open fun onStartNestedScroll(@NonNull child: @NonNull View, @NonNull target: @NonNull View, axes: Int): Boolean
open fun onStartNestedScroll(@NonNull child: @NonNull View, @NonNull target: @NonNull View, axes: Int, type: Int): Boolean
Link copied to clipboard
open fun onStopNestedScroll(@NonNull target: @NonNull View)
open fun onStopNestedScroll(@NonNull target: @NonNull View, type: Int)
Link copied to clipboard
Link copied to clipboard
open fun requestChildRectangleOnScreen(child: View, rectangle: Rect, immediate: Boolean): Boolean
Link copied to clipboard
open fun requestDisallowInterceptTouchEvent(disallowIntercept: Boolean)
Link copied to clipboard
Enables or disables whether certain key events will trigger automatic collapsing of the AppBarLayout.
Link copied to clipboard
Sets the last nested scrolling child view.
Link copied to clipboard
open fun setFitsSystemWindows(fitSystemWindows: Boolean)
Link copied to clipboard
Link copied to clipboard
open fun setStatusBarBackground(@Nullable bg: @Nullable Drawable)
Set a drawable to draw in the insets area for the status bar.
Link copied to clipboard
Set a drawable to draw in the insets area for the status bar.
Link copied to clipboard
Set a drawable to draw in the insets area for the status bar.
Link copied to clipboard
open fun setVisibility(visibility: Int)