GridView getNumColumns - 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 getNumColumns 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);
 
	} 
} 
8
CodeRank
Experience pair programming with AI  Get Codota for Java
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);
 
	} 
} 
7
CodeRank
Experience pair programming with AI  Get Codota for Java
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);
 
	} 
} 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getNumColumns
    private int getImageHeight(final GridView gridView) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN)
            return (int)(gridView.getColumnWidth() * IMAGE_SIZE_RATIO);
 
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
            return (int)((getScreenWidth() / gridView.getNumColumns()) * IMAGE_SIZE_RATIO);
 
        return imgHeight;
    } 
 
    public int getScreenWidth() { 
        if (context == null)
            return 0; 
 
        return getDisplayMetrics().widthPixels;
    } 
 
    public DisplayMetrics getDisplayMetrics() {
        final WindowManager windowManager = (WindowManager)context.getSystemService(Context.WINDOW_SERVICE);
        final DisplayMetrics metrics = new DisplayMetrics();
4
CodeRank
Experience pair programming with AI  Get Codota for Java

Related GridView getNumColumns Questions & Answers:

getNumColumns Method Overview
Get the number of columns in the grid.
See Code Examples for other Android GridView Methods: