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

后端 未结 11 1584
臣服心动
臣服心动 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 01:12

    This is the easiest and simplest method I came across. And it works like a charm.

    view.addOnScrollListener(new View.OnScrollListener() {
                    @Override
                    public void onScrolled(@NonNull View view, int dx, int dy) {
                        if (dy > 0) {
                            //Scrolling down
                        } else if (dy < 0) {
                            //Scrolling up
                        }
                    }
                });
    

提交回复
热议问题