我正在自动滚动ListView,其中有1000个项目..通过运行一个运行SmoothScroll的线程,我允许用户通过停止线程直到列表视图滚动并再次启动线程来滑动ListView..一切都很好,但问题是刷卡后自动滚动启动之间有延迟。如何实现从滑动滚动到自动滚动的平滑过渡。

protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
                --------
                --------
                ThreadAutoScroll();
}

private void autoScroll() {


            if(!touched)
            {
                listView.smoothScrollBy(1,30);
            }

    }

public onTouch(Moition event)
{
switch(event.getAction())
        {
        case MotionEvent.ACTION_DOWN:
            touched = true ;
            break;
            }
}

public void onScrollStateChanged(AbsListView view, int scrollState) {
        // TODO Auto-generated method stub

        if(touched && scrollState =0)
               {
                 touched = true;
               }
    }

最佳答案

设置listview的平滑scollbar,如下所示:

listView.setSmoothScrollbarEnabled(true);

10-07 19:21
查看更多