How to detect ScrollView's not scrolling state?
Source: Me, StackOverflow
Question: how to detect when a ScrollView
stop scrolling?
Answer:
private ScrollView mScrollView;
private float lastY;
mScrollView = (ScrollView)findViewById(R.id.find_friend_scroll_view);
mScrollView.getViewTreeObserver().addOnScrollChangedListener(new ViewTreeObserver.OnScrollChangedListener() {
@Override
public void onScrollChanged() {
if(lastY < mScrollView.getY() || lastY > mScrollView.getY()){
//scrollView is scrolling, do your stuff here
if (!isMenuFading()) {
fadeMenuOut();
lastY = mScrollView.getY();
}
}else{
//scrollView stop
fadeMenuIn();
}
}
});