Skip to content

Latest commit

 

History

History
38 lines (30 loc) · 1.4 KB

item_animators.md

File metadata and controls

38 lines (30 loc) · 1.4 KB

Item Animators

recyclerView.itemExpandAnimator = ItemExpandAnimator.split() / scale() / none()

InboxRecyclerView offers three kinds of animators for animating list items while the content is expanding, collapsing or being pulled.

  1. Split (video)
  2. Scale (video)
  3. None (video)

Customize

By default, a duration of 350ms and the FastOutSlowInInterpolator() interpolator are used for item animations. This can be changed using,

pageLayout.animationDurationMillis = CUSTOM_DURATION
pageLayout.animationInterpolator = CUSTOM_INTERPOLATOR

Make your own

Custom animations can be written by extending ItemExpandAnimator:

recyclerView.itemExpandAnimator = object : ItemExpandAnimator() {
  override fun onPageMove(
    recyclerView: InboxRecyclerView,
    page: ExpandablePageLayout,
    anchorViewOverlay: View?
  ) {
    // This function gets called every time the page changes its position or size.
    // You'll want to describe frames of your animation here by syncing the position
    // of list items with the page. Avoid doing anything expensive, just like how
    // you'd treat onDraw().
  }
}