GridView getAdapter - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for GridView getAdapter method.

This code example shows how to use the following methods: getLayoutParams, setLayoutParams, getAdapter, getNumColumns
		lp.height = height;
		lv.setLayoutParams(lp);
	} 
 
	public static void makeGridViewFullSize(GridView gv, int itemHeight) {
		int itemCount = gv.getAdapter().getCount();
		int columns = gv.getNumColumns();
		int lines = (int) (itemCount / columns);
		if (itemCount % columns != 0) {
			lines++;
		} 
		ViewGroup.LayoutParams lp = gv.getLayoutParams();
		lp.height = lines * itemHeight;
		gv.setLayoutParams(lp);
 
	} 
} 
Full Snippet Info
8
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: getLayoutParams, setLayoutParams, getAdapter, getNumColumns
		lp.height = height;
		lv.setLayoutParams(lp);
	} 
 
	public static void makeGridViewFullSize(GridView gv, int itemHeight) {
		int itemCount = gv.getAdapter().getCount();
		int columns = gv.getNumColumns();
		int lines = (int) (itemCount / columns);
		if (itemCount % columns != 0) {
			lines++;
		} 
		ViewGroup.LayoutParams lp = gv.getLayoutParams();
		lp.height = lines * itemHeight;
		gv.setLayoutParams(lp);
 
	} 
} 
Full Snippet Info
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: getChildAt, getChildCount, getListPaddingTop, getAdapter
                newLastChild.getId());
    } 
     
    @LargeTest 
    public void testShortScroll() { 
        View firstChild = mGridView.getChildAt(0);
        if (firstChild.getTop() < this.mGridView.getListPaddingTop()) {
            firstChild = mGridView.getChildAt(1);
        } 
             
        View lastChild = mGridView.getChildAt(mGridView.getChildCount() - 1);
         
        int lastTop = lastChild.getTop();
         
        TouchUtils.dragViewBy(this, firstChild, Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL, 0,
                ViewConfiguration.getTouchSlop() + 1 + 10);
         
        View newLastChild = mGridView.getChildAt(mGridView.getChildCount() - 1);
         
        assertEquals("View scrolled to wrong position", lastTop, newLastChild.getTop() - 10);

6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: getLayoutParams, setLayoutParams, getAdapter
        lp.height = height;
        lv.setLayoutParams(lp);
    } 
 
    public static void makeGridViewFullSize(GridView gv, int itemHeight, int rowNum) {
        int itemCount = gv.getAdapter().getCount();
        int lines = (int) (itemCount / rowNum);
        if (itemCount % rowNum != 0) {
            lines++;
        } 
        ViewGroup.LayoutParams lp = gv.getLayoutParams();
        lp.height = lines * itemHeight;
        gv.setLayoutParams(lp);
 
    } 
 
    public static int getActionBarHeight() { 
        TypedArray a = context.obtainStyledAttributes(new int[]{ACTIONBAR_HEIGHT});
        int ret = a.getDimensionPixelSize(0, -1);
        a.recycle();
Full Snippet Info
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: getHeight, getChildAt, getChildCount, getListPaddingBottom, getAdapter
                mGridView.getHeight() - mGridView.getListPaddingBottom(), lastChild.getBottom());
    } 
     
    @MediumTest 
    public void testPushUpFast() { 
        TouchUtils.dragViewToTop(this, mGridView.getChildAt(mGridView.getChildCount() - 1), 2);
 
        // 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());
    } 
 

6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE

Related GridView getAdapter Questions & Answers:

getAdapter Method Overview
Returns the adapter currently associated with this widget.
See Code Examples for other Android GridView Methods: