Java tutorial
//package com.java2s; //License from project: Open Source License import android.widget.GridView; public class Main { public static boolean gridViewSmoothScrollCaculate(int position, int beforepostion, int[] beforeFirstAndLastVible, boolean isGridViewUp, int popHeight, GridView movieGv) { boolean isSameContent = position >= beforeFirstAndLastVible[0] && position <= beforeFirstAndLastVible[1]; if (position >= 5 && !isSameContent) { if (beforepostion >= beforeFirstAndLastVible[0] && beforepostion <= beforeFirstAndLastVible[0] + 4) { if (isGridViewUp) { movieGv.smoothScrollBy(-popHeight, 1000); return true; } } else { if (!isGridViewUp) { movieGv.smoothScrollBy(popHeight, 1000 * 2); return true; } } } return false; } }