Why creating ripple effect is difficult on pre lol

2019-09-22 11:42发布

When I've applied ripple effect to the UI having OS version lower than lollipop, at that time first of all, ripple effect is completed and then other UI process is started.

So, it is making UI process slower: as ripple animation is completing first of all and then doing next UI process.

1条回答
兄弟一词,经得起流年.
2楼-- · 2019-09-22 12:07

As per my understanding...You are asking that Why ripple effect is smooth on devices having lollipop or later versions while not working so smooth on devices having older versions then lollipop?

If so then answer is, because.... Whole UI of android managed in one main thread(P.S. Before Lollipop). With more complex and rich apps layouts, The UI itself becomes much more demanding and needs more time for measure, draw and layout operations.

Render thread introduced in Android Lollipop helps with these situation by breaking apart two processes of rendering. In short we have list of atomic animations created in UI toolkit thread and then we send them into render thread which exists separately. Thanks that it will continue to perform these atomic animations even if the UI toolkit thread is doing an expensive operations (like inflating an activity for example).

And actually this is how ripples work. They are executed in render thread, completely autonomous of the UI Toolkit thread, thanks that they cannot be interrupted or stopped even if the new activity window is coming up.

And that’s why there is no (simple) way to achieve ripple effect in pre-21 Android system.

Reference: http://frogermcs.github.io/InstaMaterial-concept-part-3-feed-and-comments-buttons/

查看更多
登录 后发表回答