Example usage for android.widget GridView smoothScrollBy

List of usage examples for android.widget GridView smoothScrollBy

Introduction

In this page you can find the example usage for android.widget GridView smoothScrollBy.

Prototype

public void smoothScrollBy(int distance, int duration) 

Source Link

Document

Smoothly scroll by distance pixels over duration milliseconds.

Usage

From source file:Main.java

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;
            }/*from ww  w.  j  a  v a2s . c om*/
        } else {

            if (!isGridViewUp) {

                movieGv.smoothScrollBy(popHeight, 1000 * 2);
                return true;

            }
        }

    }
    return false;
}