Created
November 22, 2018 07:52
-
-
Save AB1209/783760d569251609b2f9cb795c6abf33 to your computer and use it in GitHub Desktop.
Custom ScrollView which observes vertically scrolling.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ObservableScrollView extends ScrollView { | |
private ScrollViewListener scrollViewListener = null; | |
public ObservableScrollView(Context context) { | |
super(context); | |
} | |
public ObservableScrollView(Context context, AttributeSet attrs, int defStyle) { | |
super(context, attrs, defStyle); | |
} | |
public ObservableScrollView(Context context, AttributeSet attrs) { | |
super(context, attrs); | |
} | |
public void setScrollViewListener(ScrollViewListener scrollViewListener) { | |
this.scrollViewListener = scrollViewListener; | |
} | |
@Override | |
protected void onScrollChanged(int x, int y, int oldx, int oldy) { | |
super.onScrollChanged(x, y, oldx, oldy); | |
if (scrollViewListener != null) { | |
scrollViewListener.onScrollChanged(this, x, y, oldx, oldy); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment