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);
}
}
});