Animation (scrolling) one ViewGroup blocks unbound views from animation until finished

Hierarchy view:

[0/6] View (first view in layout)
...
[2/6] RecyclerView
... 
RecyclerView children views
...
[6/6] View (point of interest, on top)

      

Purpose:

I need to push (using an accelerating interpolator) the last view (which is a custom toolbar) in my hierarchy when it RecyclerView

scrolls high enough and pops it out when it RecyclerView

is low enough. An effect similar to the sliding heading title https://material.io/ .

Problem:

Toolbar animations - (view initially hidden):

title_bar.animate()
         .setInterpolator(FastOutSlowInInterpolator())
         .setDuration(500)
         .setStartDelay(0)
         .translationY(0f)
         .start()

      

and hide it:

title_bar.animate()
         .setInterpolator(FastOutSlowInInterpolator())
         .setDuration(500)
         .setStartDelay(0)
         .translationY(someValue)
         .start()

      

The problem is that the animation won't work until RecyclerView

it scrolls (key-up).

I suspect the animation is being queued in the FIFO and until it stops before scrolling. I don't understand why this might be the case, because the two views are completely independent and are RecyclerView

located below my toolbar.

Twist

This works great:

title_bar.animate()
         .setInterpolator(FastOutSlowInInterpolator())
         .setDuration(0) // <-- duration is zero
         .setStartDelay(0)
         .translationY(someValue)
         .start()

      

i.e. the animation starts immediately (is it possibly equivalent title_bar.translationY = someValue

?)

So what exactly is going on here?

+3


source to share





All Articles