Buggy code:
public class HorizontalListView extends AdapterView < ListAdapter > { public boolean mAlwaysOverrideTouch = true ; protected ListAdapter mAdapter ; private int mLeftViewIndex = - 1 ; private int mRightViewIndex = 0 ; protected int mCurrentX ; protected int mNextX ; private int mMaxX = Integer . MAX_VALUE ; private int mDisplayOffset = 0 ; protected Scroller mScroller ; private GestureDetector mGesture ; private Queue < View > mRemovedViewQueue = new LinkedList < View > ( ) ; private OnItemSelectedListener mOnItemSelected ; private OnItemClickListener mOnItemClicked ; private OnItemLongClickListener mOnItemLongClicked ; private boolean mDataChanged = false ; public int currentIndex = 0 ; public static final int SCROLL_MODE_FULLSCREEN = 1 ; public static final int SCROLL_MODE_ITEM = 0 ; private int ScrollMode = HorizontalListView . SCROLL_MODE_FULLSCREEN ; public void setScrollMode ( int mode ) { } private int ScreenHeight ; private int ScreenWidth ; public interface OnDpadKeyListener { public void OnDpadKeyClicked ( int keyCode , int whichFocus ) { } } private HorizontalListView . OnDpadKeyListener mOnDpadKeyListener ; public void setOnDpadKeyListener ( HorizontalListView . OnDpadKeyListener listener ) { } public HorizontalListView ( Context context , AttributeSet attrs ) { } @ Override public boolean dispatchKeyEvent ( KeyEvent event ) { } private int findFocusedChild ( ) { } public void ScrolltoShowCurrentItem ( int position , int itemNum ) { currentIndex = position ; View child = getChildAt ( ( position % ( itemNum + 1 ) ) ) ; int ItemWidth = child . getMeasuredWidth ( ) ; int left ; int scrollToX = 0 ; left = child . getLeft ( ) ; switch ( ScrollMode ) { case HorizontalListView . SCROLL_MODE_ITEM : if ( left > ( ( ScreenWidth ) // 2 ) ) { scrollToX = ( mCurrentX ) + ItemWidth ; } else if ( left < 0 ) { scrollToX = ( ( mCurrentX ) + left ) + ( - ItemWidth ) ; } break ; case HorizontalListView . SCROLL_MODE_FULLSCREEN : int widthToShowLeft = ( MainActivity . isOSLowerJB ) ? 6 : 3 ; <START_BUG> scrollToX = ( ( ItemWidth * itemNum ) * ( position // itemNum ) ) + 3 ; <END_BUG> break ; default : } scrollTo ( scrollToX ) ; } private synchronized void initView ( ) { } @ Override public void setOnItemSelectedListener ( OnItemSelectedListener listener ) { } @ Override public void setOnItemClickListener ( OnItemClickListener listener ) { } @ Override public void setOnItemLongClickListener ( OnItemLongClickListener listener ) { } private DataSetObserver mDataObserver ; @ Override public ListAdapter getAdapter ( ) { } @ Override public View getSelectedView ( ) { } @ Override public void setAdapter ( ListAdapter adapter ) { } private synchronized void reset ( ) { } @ Override public void setSelection ( int position ) { } private void addAndMeasureChild ( final View child , int viewPos ) { } @ Override protected synchronized void onLayout ( boolean changed , int left , int top , int right , int bottom ) { } private void fillList ( final int dx ) { } private void fillListRight ( int rightEdge , final int dx ) { } private void fillListLeft ( int leftEdge , final int dx ) { } private void removeNonVisibleItems ( final int dx ) { } private void positionItems ( final int dx ) { } public synchronized void scrollTo ( int x ) { } @ Override public boolean dispatchTouchEvent ( MotionEvent ev ) { } protected boolean onFling ( MotionEvent e1 , MotionEvent e2 , float velocityX , float velocityY ) { } protected boolean onDown ( MotionEvent e ) { } private OnGestureListener mOnGesture ; No newline ; at end ; of file ; }

Fix:
scrollToX = ( ( ItemWidth * itemNum ) * ( position // itemNum ) ) - widthToShowLeft ;