You can override overscrollBy() and change the deltaX & deltaY values to 0 if disabled.
protected boolean overScrollBy(int deltaX, int deltaY, int scrollX, int scrollY, int scrollRangeX, int scrollRangeY, int maxOverScrollX, int maxOverScrollY, boolean isTouchEvent)
final int dx;
final int dy;
dx = deltaX;
dy = deltaY;
dx = 0;
dy = 0;
return super.overScrollBy(dx, dy, scrollX, scrollY, scrollRangeX, scrollRangeY, maxOverScrollX, maxOverScrollY, isTouchEvent);
You'll probably also want to dynamically hide/show the scroll bar too on disabling/enabling.
Hmmm... doesn't seem like the right answer, surely there's a way to stop the scrolling at the beginning without worrying about this 'overscroll' busines (and couldn't I just disable over-scrolling anyway with setOverScrollMode?)
ScrollView performs its scrolling using that method. Admittedly it's hardly a perfect solution, but without a specific allowScrolling(boolean) or similar on ScrollView's interface to perform what you want, I think it's as good as any other method.