在ListView中单击项目时调用的OnScrollListener.onScroll() [英] OnScrollListener.onScroll() called on item click in a ListView

查看:73
本文介绍了在ListView中单击项目时调用的OnScrollListener.onScroll()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个OnScrollListenerOnItemClickListener的ListView.当我单击一个项目时,会同时触发OnScrollListenerOnItemClickListener中的onScroll()方法.

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.

是否有防止这种行为的方法?如果没有,我怎么能在onScroll()内分辨出用户是否真的在滚动或只是在单击?

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?

推荐答案

我认为onScrollStateChanged也应通过滚动调用.然后,您应该能够查看状态是否处于空闲状态或滚动浏览本主题.

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.

这篇关于在ListView中单击项目时调用的OnScrollListener.onScroll()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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