RecyclerView实现垂直自动无限滚动,类似于中奖信息,跑马灯
实现RecyclerView中的效果有两种:
一种为以item为单体,每隔多少秒进行滚动一次
一种为整体流形式进行缓慢滚动
item为单位进行滚动
流形式进行滚动
实现无限滚动
这里实现无限滚动的方式为在adpater中设置itemCount为 Integer.MAX_VALUE
注意:此处基于BaseQuickAdapter的库进行的,也可直接使用原生
class MainAdatper(data: List) : BaseQuickAdapter(R.layout.item_txt, data) {
override fun convert(helper: BaseViewHolder?, item: String?) {
helper?.setText(R.id.mTv, item)
}
override fun getItem(position: Int): String? {
val newPosition = pos