Did this!
Besides the fix Alexandre kindly provided me, I had to create an interface:
public interface ScrollViewListener { void onScrollChanged(ScrollViewExt scrollView, int x, int y, int oldx, int oldy); }
Then I had to override the OnScrollChanged method from ScrollView in my ScrollViewExt:
public class ScrollViewExt extends ScrollView { private ScrollViewListener scrollViewListener = null; public ScrollViewExt(Context context) { super(context); } public ScrollViewExt(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public ScrollViewExt(Context context, AttributeSet attrs) { super(context, attrs); } 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); } } }
Now, as Alexandre said, put the package name in the XML tag (my mistake), make my Activity class implement the previously created interface, and then put it all together:
scroll = (ScrollViewExt) findViewById(R.id.scrollView1); scroll.setScrollViewListener(this);
And in the OnScrollChanged method, from the interface ...
@Override public void onScrollChanged(ScrollViewExt scrollView, int x, int y, int oldx, int oldy) {
And it worked!
Thank you very much for your help, Alexander!