CoordinateLayout简介

CoordinateLayout简介

参考:CoordinatorLayout

CoordinatorLayout is a super-powered FrameLayout.

CoordinatorLayout是一个更强大的FrameLayout

CoordinatorLayout is intended for two primary use cases:

CoordinatorLayout主要有两个使用场景:

  • As a top-level application decor or chrome layout
  • 作为顶级应用程序装饰或镀铬布局
  • 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 using the DefaultBehavior annotation.

通过为CoordinatorLayout中的子视图指定行为,你可以在一个父布局下提供许多不同的交互,这些子视图也可以进行相互交互。视图类可以指定默认的行为,当其作为使用默认注解的CoordinatorLayout的子视图时,默认行为会被调用。

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.

CoordinatorLayout的子元素可能拥有锚点,该视图ID必须对应于CoordinatorLayout的任意后代,但它可能不是被锚定的子对象本身或被锚定的子对象的后代。这可以用来放置相对于其他任意内容窗格的浮动视图。

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.

子控件可以指定insetEdge(描述此子视图如何插入CoordinatorLayout的重力值。 其他被设置为闪避的相同边缘的子视图将被适当地移动,以使视图不重叠。)来描述如何插入CoordinatorLayout。任何通过dodgeInserEdges设置了相同插入边缘的子视图将被适当的移动,以便视图不重叠。

原文地址:https://www.cnblogs.com/xl-phoenix/p/8276657.html