同步两个ListView控件位置 [英] Synchronize two ListView positions

查看:160
本文介绍了同步两个ListView控件位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个列表视图。有没有什么办法,当我滚动列表中的任何一个同步列表视图的位置

I have two ListViews. Is there any way to synchronize the position of ListViews when I scroll any one of the Lists

推荐答案

实现一个的 AbsListView.OnScrollListener ,注册到ListView。当ListView的滚动,OnScrollListener的onScroll()方法将被触发,然后调用<一个href="http://developer.android.com/reference/android/widget/AbsListView.html#smoothScrollToPosition%28int%29"相对=nofollow> smoothScrollToPosition()在另一个的ListView 同步到相同的位置。

Implement an AbsListView.OnScrollListener, register to the ListView. When the ListView is scrolled, the onScroll() method of OnScrollListener will be triggered, then call smoothScrollToPosition() on another ListView to synchronize to the same position.

这篇关于同步两个ListView控件位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆