隐藏底部状态栏

225 阅读1分钟
    mNestedScrollView.setOnScrollChangeListener(new NestedScrollView.OnScrollChangeListener() {
        @Override
        public void onScrollChange(NestedScrollView v, int scrollX, int scrollY, int
                oldScrollX, int oldScrollY) {

            //上滑 并且 正在显示底部栏
            if (scrollY - oldScrollY > 0 && isBottomShow) {
                isBottomShow = false;
                //将Y属性变为底部栏高度 (相当于隐藏了)
                mBottomView.animate().translationY(mBottomView.getHeight());
            } else if (scrollY - oldScrollY < 0 && !isBottomShow) {
                isBottomShow = true;
                mBottomView.animate().translationY(0);
            }
        }
    });