Android ScrollView滑动到顶部和滑动到底部的判断

svView.setOnScrollChangeListener(new View.OnScrollChangeListener() {
            @Override
            public void onScrollChange(View v, int scrollX, int scrollY, int oldScrollX, int oldScrollY) {
                if (svView.getScrollY() == 0) {
                    //顶部
                }

                View contentView = svView.getChildAt(0);
                if (contentView != null && contentView.getMeasuredHeight() == (svView.getScrollY() + svView.getHeight())) {
                    //底部
                }

            }
        });

你可能感兴趣的:(Android)