Skip to content

Handling Scrolls with CoordinatorLayout #80

@nesquena

Description

@nesquena

Building off of #78, we need guides for coordinating using the new CoordinatorLayout:

  • Scrolling up or down the floating action button slides up and down (See guide)
  • CoordinatorLayout - a layout which provides an additional level of control over touch events between child views
    • A great use of this is when you add a FloatingActionButton as a child of your CoordinatorLayout and then pass that CoordinatorLayout to your Snackbar.make() call - instead of the snackbar displaying over the floating action button, the FloatingActionButton takes advantage of additional callbacks provided by CoordinatorLayout to automatically move upward as the snackbar animates in and returns to its position when the snackbar animates out
    • CoordinatorLayout also provides an layout_anchor attribute which, along with layout_anchorGravity, can be used to place floating views, such as the FloatingActionButton, relative to other views.
  • AppBarLayout - allows your Toolbar and other views (such as tabs provided by TabLayout) to react to scroll events in a sibling view marked with a ScrollingViewBehavior
    • app:layout_behavior and app:layout_scrollFlags
  • CollapsingToolbarLayout
    • Affords detailed control on how different elements react to collapsing
    • CollapsingToolbarLayout’s app:layout_collapseMode="pin"
    • app:layout_collapseMode="parallax" and app:layout_collapseParallaxMultiplier="0.7"
    • app:contentScrim="?attr/colorPrimary"
  • Setup ToolBar to show and hide as you scroll.
  • Header of the list docks to top of the screen

References:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions