简体   繁体   English

android animate recycler查看第一项

[英]android animate recycler view first item

I'm trying to do a recycler view animation on scroll, but im struggling to get it started. 我正在尝试滚动地制作一个回收者视图动画,但是我很难开始它。

Basically, the animation will happen on scroll and always on the first visible child (and only on this one). 基本上,动画将在滚动上发生,并且始终在第一个可见子对象上(且仅在该子对象上)发生。 When the user scrolls the recycler view, second item should overlap the first, and the first will slowly fade out. 当用户滚动回收器视图时,第二项应与第一项重叠,并且第一项将逐渐淡出。 reverse animation when sliding down. 向下滑动时反转动画。

In short, when the list scroll top for example, when the first item goes offscreen and want to change that behaviour. 简而言之,例如,当列表滚动到顶部时,当第一项不在屏幕上并想要更改该行为时。 Instead of going offscreen, it slowly fades based on scroll dY and stay in the same position. 而不是离开屏幕,它会根据滚动dY逐渐淡入并保持在相同位置。

Any hints would be much appreciated. 任何提示将不胜感激。

I think this answer may can help you. 我认为这个答案可能会帮助您。 I used code like this in my app and work smootly. 我在应用程序中使用了这样的代码,因此工作顺利。

https://stackoverflow.com/a/29714138/2971619 https://stackoverflow.com/a/29714138/2971619

Hope to be usefull for you too! 希望对您也有用!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM