向列表条目自动无限循环滚动,比如数组5条数据,怎么实现无限循环滚动
我用Scroll来实现,数据做不到无限循环,有没有什么控件可以实现数据无线循环滚动效果
ListItem() {
Column() {
Row() {
Scroll(this.scrollerColumn) {
Row({ space: 5 }) {
ForEach(item.subSectionList, (item: SubSection) => {
Text(item.subsectionname)
.fontSize(14)
.fontColor(Color.Red)
.border({
style: BorderStyle.Solid,
width: 1,
color: Color.Red,
radius: 10
})
.padding({
left: 5,
right: 5,
top: 3,
bottom: 3
})
.margin({ left: 10 })
.onClick(() => {
router.pushUrl({
url: 'pages/newsdetail/NewsDetailPage',
params: {
id: item.subsectionid,
}
}, router.RouterMode.Single)
})
})
}
}.scrollable(ScrollDirection.Horizontal) //设置滚动方向
.scrollBar(BarState.Off)
.width('100%')
}
}.backgroundColor('#F6F6F6')
.padding({ top: 15, bottom: 15 })
}
参考示例如下: