Hello folks I'm trying to handle an onScrolled
event in my recyclerView
, that's inside a NestedScrollView
.
So far, I have found setOnScrollChangeListener
, however this method is API 23, and I'm targeting API 21, any idea to handle this issue back in API 21?
I think you are using setOnChangeScrollListener with View.OnScrollChangeListener. Please use NestedScrollView.OnScrollChangeListener like that:
scvProduct.setOnScrollChangeListener(new NestedScrollView.OnScrollChangeListener() {
@Override
public void onScrollChange(NestedScrollView nestedScrollView,int scrollX, int scrollY, int oldScrollX, int oldScrollY) {
Log.e("ProductFragment","position button " + topPositionButton + " scrollY " + scrollY);
if(scrollY > oldScrollY){
Log.e("ProductFragment","down");
}
else{
Log.e("ProductFragment","up");
}
}
});