如何通过代码在一段时间后动态滚动我的列表?
我有一个由 SimpleAdapter 填充的 ListView。简单的适配器填充使用 哈希映射。
列表中的每个 TextView 都显示歌曲的歌词。假设当前有 2 项列表 完全可见,第三个半可见半隐藏,如下所示:
我正在使用 MediaPlayer 播放歌曲。当第二首歌曲播放结束时,我需要滚动列表 这样列表的第三项(由于屏幕分辨率而被一半隐藏)可以出现在顶部 如下:
我想在 mediaPlayer 处于 PlaybackCompleted 状态(即第二首歌曲结束时)时实现此场景。我应该怎么做?我对android还是比较了解,请指导我!
I have a ListView which is populated by SimpleAdapter. Simple adapter is stuffed using
HashMap.
Each TextView in the List shows lyrics of a song. Suppose at current time 2 items of list
are fully visible and 3rd is half visible and half hidden as follows:
I am using MediaPlayer to play songs. When 2nd song playback ends, I need to scroll the list
so that 3rd item of list (which is half hidden due to screen resolution) could come on top
as below:
I want to implement this scenario whe mediaPlayer is on PlaybackCompleted state i.e. when 2nd song is ended. How should i do this? I am still a bigner in android please guide me!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
阅读文档后,我知道 ListView.smoothScrollToPosition(intposition) 或 ListView.setSelection(intposition) 方法将满足这种情况。
After reading the documentation i have come to know that ListView.smoothScrollToPosition(int position) or ListView.setSelection(int position) methods will fulfill this scenario.