Code example for GridView

Methods: getChildAtgetChildCountgetAdapter, getHeight, getListPaddingBottom, getSelectedItemPosition, scrollToTop

0
                mGridView.getHeight() - mGridView.getListPaddingBottom(), lastChild.getBottom());
    } 
 
    @MediumTest 
    public void testPullDown() { 
        TouchUtils.scrollToTop(this, mGridView);
 
        // Nothing should be selected 
        assertEquals("Selection still available after touch", -1,
                mGridView.getSelectedItemPosition());
 
        View lastChild = mGridView.getChildAt(mGridView.getChildCount() - 1);
 
        assertEquals("Last item not the last child in the grid",
                mGridView.getAdapter().getCount() - 1, lastChild.getId());
 
        assertEquals("Last item not at the bottom of the grid",
                mGridView.getHeight() - mGridView.getListPaddingBottom(), lastChild.getBottom());
    } 
     
    @MediumTest 
    public void testPushUpFast() { 
        TouchUtils.dragViewToTop(this, mGridView.getChildAt(mGridView.getChildCount() - 1), 2);