如何检测的Andr​​oid ListView的滚动停止? [英] how to detect Android ListView Scrolling stopped?

查看:98
本文介绍了如何检测的Andr​​oid ListView的滚动停止?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图滚动stopped.So后做什么,我试图用 OnScrollListener#onScrollStateChanged(SCROLL_STATE_IDLE),以检测当滚动停止(以 TOUCH_SCROLL或FLING )(1.5是运行像我期望的那样)。 但是,当它运行在2.0,onScrollStateChanged不能接受的情况下释放finger.Is有任何回调或反正检测到事件之后?

I'm trying to do something after scrolling stopped.So, I tried using OnScrollListener#onScrollStateChanged(SCROLL_STATE_IDLE) to detect when the scrolling stopped(either TOUCH_SCROLL or FLING)(at 1.5 it's runs as i expect). But when it runs on 2.0, onScrollStateChanged can't received the event after releasing the finger.Is there any callback or anyway to detect that event?

推荐答案

尝试使用setOnScrollListener并实现onScrollStateChanged与scrollState == 0 ...做你需要做的......

Try using the setOnScrollListener and implement the onScrollStateChanged with scrollState == 0 ... do what you need to do...

setOnScrollListener(new OnScrollListener() {
    public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
        // TODO Auto-generated method stub
    }

    public void onScrollStateChanged(AbsListView view, int scrollState) {
        if (scrollState == OnScrollListener.SCROLL_STATE_IDLE) {
            Log.i("a", "scrolling stopped...");
        }
    }
});

这篇关于如何检测的Andr​​oid ListView的滚动停止?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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