Java tutorial
//package com.java2s; //License from project: Apache License import android.widget.GridView; public class Main { /** * smoothScroll a specific item to the center of the list :D * * @param position */ public static void smoothScrollToCenterPosition(GridView gridView, int position) { int pos = position; if (position <= gridView.getFirstVisiblePosition()) { pos = position - (gridView.getChildCount() / 2); if (pos < 0) { pos = 0; } gridView.smoothScrollToPosition(pos); } else { pos = position + (gridView.getChildCount() / 2); if (pos >= gridView.getCount()) { pos = gridView.getCount() - 1; if (pos < 0) { pos = 0; } } } gridView.smoothScrollToPosition(pos); } }