CymChad / BaseRecyclerViewAdapterHelper

BRVAH:Powerful and flexible RecyclerAdapter
http://www.recyclerview.org/
MIT License
24.2k stars 5.14k forks source link

关于动画这块,因为itemView被加载到页面的时候,时间间隔太快的话,动画会一起执行,并不是很美观。 #3788

Closed lihangleo2 closed 10 months ago

lihangleo2 commented 11 months ago

我5年前也封装过一个BaseAdapter,完美解决了这个问题。作者有空可以借鉴一下(原因是:根据itemView的不同复杂布局,加载带window上的时间差异会不同),或者我可以pull一个请求。5年前封装的BaseAdapter 核心代码就是这个 ` var nowMillis = System.currentTimeMillis() //这里处理的是当前页显示的item执行动画的间隔太快,看不出效果 if (nowMillis - currentMillons >= 10) { delyTimePosi = 1 currentMillons = nowMillis holder.itemView.startAnimation(animator) } else { delyTimePosi++ currentMillons = nowMillis animator.startOffset = (50 * delyTimePosi).toLong() holder.itemView.startAnimation(animator) }

lihangleo2 commented 11 months ago

话说,作者封装的baseAdapter基本该考虑的功能都做好了。真牛

limuyang2 commented 11 months ago

你是用的3.0版本,还是4.0?这里我思考下,用delay并不少太准确

limuyang2 commented 10 months ago

你可以重写 startItemAnimator() 方法,到达你的目的