protected void smoothScrollByOffset(int position){
  int index=-1;
  if (position < 0) {
    index=getFirstVisiblePosition();
  }
 else   if (position > 0) {
    index=getLastVisiblePosition();
  }
  if (index > -1) {
    View child=getChildAt(index - getFirstVisiblePosition());
    if (child != null) {
      Rect visibleRect=new Rect();
      if (child.getGlobalVisibleRect(visibleRect)) {
        int childRectArea=child.getWidth() * child.getHeight();
        int visibleRectArea=visibleRect.width() * visibleRect.height();
        float visibleArea=(visibleRectArea / (float)childRectArea);
        final float visibleThreshold=0.75f;
        if ((position < 0) && (visibleArea < visibleThreshold)) {
          ++index;
        }
 else         if ((position > 0) && (visibleArea < visibleThreshold)) {
          --index;
        }
      }
      smoothScrollToPosition(Math.max(0,Math.min(getCount(),index + position)));
    }
  }
}

protected void smoothScrollByOffset ( int position ) { int index = - 1 ; if ( position < 0 ) { index = getFirstVisiblePosition ( ) ; } else if ( position > 0 ) { index = getLastVisiblePosition ( ) ; } if ( index > - 1 ) { View child = getChildAt ( index - getFirstVisiblePosition ( ) ) ; if ( child != null ) { Rect visibleRect = new Rect ( ) ; if ( child . getGlobalVisibleRect ( visibleRect ) ) { int childRectArea = child . getWidth ( ) * child . getHeight ( ) ; int visibleRectArea = visibleRect . width ( ) * visibleRect . height ( ) ; float visibleArea = ( visibleRectArea / ( float ) childRectArea ) ; final float visibleThreshold = 0.75f ; if ( ( position < 0 ) && ( visibleArea < visibleThreshold ) ) { ++ index ; } else if ( ( position > 0 ) && ( visibleArea < visibleThreshold ) ) { -- index ; } } smoothScrollToPosition ( Math . max ( 0 , Math . min ( getCount ( ) , index + position ) ) ) ; } } }
allows remoteviews to scroll relatively to a position .
