GridView setNumColumns - 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 setNumColumns method.

This code example shows how to use the following methods: getLayoutParams, setLayoutParams, setAdapter, setColumnWidth, setHorizontalSpacing
	    	m_oTitle2Text.setText("����������20��");
	    } 
	     
	    if( m_oInfoGrid != null )
	    { 
	    	LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams)m_oInfoGrid.getLayoutParams();
    		lp.height = dm.heightPixels - 45 - 200;
    		m_oInfoGrid.setLayoutParams(lp);
    		 
	    	m_oInfoGrid.setNumColumns(4);
	    	m_oInfoGrid.setColumnWidth(dm.widthPixels/4);
	    	m_oInfoGrid.setHorizontalSpacing(10);
	    	 
	    	String[] str = {"����\n123", "����\n123", "����\n123", "����\n123", "����\n123", "����\n123", "����\n123", "����\n123",
	    			"����\n123", "����\n123", "����\n123", "����\n123", "����\n123", "����\n123", "����\n123", "����\n123", "����\n123", 
	    			"����\n123", "����\n123", "����\n123"}; 
	    	 
	    	mySpinnerAdapter sa = new mySpinnerAdapter( this, str );
	    	m_oInfoGrid.setAdapter(sa);
	    } 

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: setAdapter, setNumColumns
	public void create() 
	{ 
		setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
		setGravity(Gravity.CENTER);
		 
		grid = new GridView(context);
		adapter = new DesktopSwitcherAdapter(context);
		 
		workspace = myHome.getInstance().getWorkspace();
		desktopCount = workspace.getDesktopCount();
		 
		columnCount = desktopCount;
		if(columnCount > 4)
			columnCount = 4;
		 
		grid.setNumColumns(columnCount);
		grid.setAdapter(adapter);
		 
		addView(grid);
	} 

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: setOverScrollMode, setColumnWidth, setGravity, setNumColumns, setVerticalSpacing
	public GridViewFragment() { 
		super(); 
	} 
 
	public void setUpGridView(GridView gv) {
		gv.setColumnWidth(200);
		gv.setGravity(Gravity.CENTER);
		gv.setOverScrollMode(View.OVER_SCROLL_ALWAYS);
		gv.setNumColumns(GridView.AUTO_FIT);
		gv.setVerticalSpacing(15);
	} 
	 
	@Override 
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
	} 
 
	@Override 
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
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: getLayoutParams, setLayoutParams, setColumnWidth, setHorizontalSpacing, setNumColumns
This code example shows how to use the following methods: setGravity, setHorizontalSpacing, setNumColumns, setStretchMode, setVerticalSpacing
		this.mResources = context.getResources();
		init(); 
	} 
	 
	private void init() { 
		mGridView = new GridView(mContext);
		mGridView.setNumColumns(4);
		mGridView.setHorizontalSpacing(10);
		mGridView.setVerticalSpacing(10);
		mGridView.setStretchMode(GridView.STRETCH_COLUMN_WIDTH);
		mGridView.setGravity(Gravity.CENTER);
		mGridView.setOnItemClickListener(this);
		setAdapterData(menu_name, menu_image);
	} 
 
	private void setAdapterData(String[] menus_name,String[] menus_image) {
		/** 数据源  **/ 
		ArrayList<HashMap<String, Object>> data = new ArrayList<HashMap<String, Object>>();
		/** 添加数据 **/ 
		 for (int i = 0; i < menus_name.length; i++) {            
Full Snippet Info
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE

Related GridView setNumColumns Questions & Answers:

Other GridView setNumColumns Examples

50:			columnWidth = (int) ((utils.getScreenWidth() - ((AppConstant.NUM_OF_COLUMNS + 1) * padding)) / AppConstant.NUM_OF_COLUMNS);
51:	
52:			gridView.setNumColumns(AppConstant.NUM_OF_COLUMNS);
53:			gridView.setColumnWidth(columnWidth);
54:			gridView.setStretchMode(GridView.NO_STRETCH);

Read More

setNumColumns Method Overview
Set the number of columns in the grid
See Code Examples for other Android GridView Methods: