Detecting the scrolling direction in the adapter (up/down)

后端 未结 11 1608
臣服心动
臣服心动 2020-12-01 00:38

I am trying to mimic the Google Plus application in my project, as it seems to be the reference now.

The listview effect when scrolling is really nice and I would li

11条回答
  •  醉话见心
    2020-12-01 00:57

    Try this . I hope it helps you . Logic From @Gal Rom Answer .

    lv.setOnScrollListener(new OnScrollListener() {
            private int mLastFirstVisibleItem;
    
            @Override
            public void onScrollStateChanged(AbsListView view, int scrollState) {
    
            }
    
            @Override
            public void onScroll(AbsListView view, int firstVisibleItem,
                    int visibleItemCount, int totalItemCount) {
    
                if(mLastFirstVisibleItemfirstVisibleItem)
                {
                    Log.i("SCROLLING UP","TRUE");
                }
                mLastFirstVisibleItem=firstVisibleItem;
    
            }
        });
    

提交回复
热议问题