以下是我的代码
现在我想在 NestedScroll 的 Scroll 上隐藏 RelativeLayoput 我做到了,但视图与此波动: android.widget.RelativeLayout{4f3557b VE.
nestedScrollView.setOnScrollChangeListener(new NestedScrollView.OnScrollChangeListener() {
@Override
public void onScrollChange(NestedScrollView v, int scrollX, int scrollY, int oldScrollX, int oldScrollY) {
Log.d("ScrollView", "scrollX : " + scrollX + " oldScrollX :" + oldScrollX + " scrollY :" + scrollY + " oldScrollY :" + oldScrollY);
if (scrollY > oldScrollY +20) {
if(relativeLayout.getVisibility()==View.VISIBLE && isTimerStart )
relativeLayout.setVisibility(View.GONE);
} else {
if(relativeLayout.getVisibility()==View.GONE && isTimerStart)
relativeLayout.setVisibility(View.VISIBLE);
}
}
});