Skip to content

Instantly share code, notes, and snippets.

@lenamuit
Created June 24, 2015 16:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lenamuit/b84e6847c49ca2a41e29 to your computer and use it in GitHub Desktop.
Save lenamuit/b84e6847c49ca2a41e29 to your computer and use it in GitHub Desktop.
ScrollViewExt with reach bottom callback
public class ScrollViewExt extends ScrollView {
private ScrollViewListener scrollViewListener;
public ScrollViewExt(Context context) {
super(context);
}
public ScrollViewExt(Context context, AttributeSet attrs) {
super(context, attrs);
}
public ScrollViewExt(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
public void setScrollViewListener(ScrollViewListener scrollViewListener) {
this.scrollViewListener = scrollViewListener;
}
@Override
protected void onScrollChanged(int l, int t, int oldl, int oldt) {
super.onScrollChanged(l, t, oldl, oldt);
if (scrollViewListener != null) {
scrollViewListener.onScrollChanged(this, l, t, oldl, oldt);
}
}
public interface ScrollViewListener {
void onScrollChanged(ScrollViewExt scrollView,
int x, int y, int oldx, int oldy);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment