OnScrollListener.onScroll() called on item click in a ListView

喜夏-厌秋 提交于 2019-12-21 16:59:22

问题


I have a ListView with an OnScrollListener and an OnItemClickListener. When I click on an item, both the onScroll() method in the OnScrollListener and the OnItemClickListener are fired.

Is there a way to prevent this behaviour? If not, how can I tell, inside onScroll(), if the user is really scrolling or he's just clicking?


回答1:


I think onScrollStateChanged should also be called with scrolling. Then you should be able to see if the state is idled or scrolling through the constants defined in OnScrollListener. Check this topic for an example.



来源:https://stackoverflow.com/questions/9665383/onscrolllistener-onscroll-called-on-item-click-in-a-listview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!