Created
November 22, 2018 07:54
-
-
Save AB1209/ff86c1ccc4346e55e1f8319bd0e76e2c to your computer and use it in GitHub Desktop.
Custom ScrollView which observers horizontal 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 ObservableHorizontalScrollView extends HorizontalScrollView { | |
private ScrollViewListener scrollViewListener = null; | |
public ObservableHorizontalScrollView(Context context) { | |
super(context); | |
} | |
public ObservableHorizontalScrollView(Context context, AttributeSet attrs, int defStyle) { | |
super(context, attrs, defStyle); | |
} | |
public ObservableHorizontalScrollView(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