private boolean scrollViewCanScrollVertically(ScrollView scrollView,int direction){
  final int offset=Math.max(0,scrollView.getScrollY());
  final int range=computeVerticalScrollRange(scrollView) - scrollView.getHeight();
  if (range == 0)   return false;
  if (direction < 0) {
    return offset > 0;
  }
 else {
    return offset < range - 1;
  }
}

private boolean scrollViewCanScrollVertically ( ScrollView scrollView , int direction ) { final int offset = Math . max ( 0 , scrollView . getScrollY ( ) ) ; final int range = computeVerticalScrollRange ( scrollView ) - scrollView . getHeight ( ) ; if ( range == 0 ) return false ; if ( direction < 0 ) { return offset > 0 ; } else { return offset < range - 1 ; } }
copy from scrollview ( api level > = 14 )
