当你从两个列表视图滚动Android的同步两个位置的ListView [英] Synchronize two ListView positions when you scroll from both list views Android
问题描述
我有两个列表视图。有没有什么办法,当我滚动两个列表以列表视图的位置同步
I have two ListViews. Is there any way to synchronize the position of ListViews when I scroll both the Lists
推荐答案
您可以在你的第二个列表视图中使用:<一href=\"http://developer.android.com/reference/android/widget/AbsListView.html#smoothScrollToPosition%28int%29\"相对=nofollow> smoothScrollToPosition(位置)
You could use this in your second list view: smoothScrollToPosition(position)
和您的第一个ListView控件,你可以使用 OnScrollListener 并检查与第一个可见项目<一个href=\"http://developer.android.com/reference/android/widget/AdapterView.html#getSelectedItemPosition%28%29\"相对=nofollow> getFirstVisiblePosition 。
And in your first ListView you could use a OnScrollListener and check the first visible item with getFirstVisiblePosition.
最良好的祝愿,
蒂姆·
Best wishes, Tim
这篇关于当你从两个列表视图滚动Android的同步两个位置的ListView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!