Home  >  Q&A  >  body text

android - Listview整体自动滚动+动画

1.Android设备无法触屏,客户需求。
2.有一个Listview显示信息,比如,当前有40个数据(数据可能随着时间增长或减少),整个屏幕最多显示10行,那就需要四个屏幕才能显示完所有的数据,那就让第一个10个数据停留n秒,然后切换到第二个屏幕,之后循环,再到第一个屏幕。每次滚屏都需要有动画。

3.1:尝试listView中只有10个数据,每次要滚屏就将数据全部清除,然后再准备第二组数据放到Listview中。
3.2:利用滚动事件,用代码自动激活滚动事件,让其滚动到指定的行数,这个还没尝试去做。
3.3:根据数据,计算出需要使用几个屏幕,然后动态创建Fragment,每个Fragment里都有一个Listview,其中只放能显示的数据,然后滚动相当于Fragment滚动。(系统开销太大,当有数据变化时每个listview数据需要全部计算,动画好像比较容易添加)

最后:有没有更好的建议???我们一起交流吧!

伊谢尔伦伊谢尔伦2728 days ago662

reply all(1)I'll reply

  • 怪我咯

    怪我咯2017-04-17 17:54:25

    First, make sure the maximum amount of data is certain. If there are only 40 items at most, you can directly use ViewPager or ScrollView to cooperate with multiple ListViews.
    If the data may be very large, it is recommended to use RecycleView to scroll to a fixed position. RecycleView comes with some animations, which will be better than ListView, but the position may be offset...

    reply
    0
  • Cancelreply