Is there any alternate listener which I can use to get scrolling amount in y axis?
I am using android.support.v7.widget.Toolbar
but it doesn't have backward compatibility to API level 19.
Is there any alternate listener which I can use to get scrolling amount in y axis?
I am using android.support.v7.widget.Toolbar
but it doesn't have backward compatibility to API level 19.
You can achieve that using ViewTreeObserver#addOnScrollChangedListener()
API:
toolbar.getViewTreeObserver().addOnScrollChangedListener(
new ViewTreeObserver.OnScrollChangedListener() {
@Override public void onScrollChanged() {
int x = toolbar.getScrollX();
int y = toolbar.getScrollY();
}
});
If i have understood properly , you can use addOnScrollChangedListener()
instead.
Hope this helps. Sorry for my english.