GridView setColumnWidth - 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 setColumnWidth 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
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:setRecyclerListener, setAdapter, setColumnWidth, setHorizontalSpacing, setStretchMode
    protected void onCreate(final Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(this.getResources().getIdentifier("test_activity_grid", "layout", "pl.polidea.androidflip3d"));
        final GridView gridView = (GridView) findViewById(this.getResources().getIdentifier("GridView", "id",
                "pl.polidea.androidflip3d")); 
        gridView.setHorizontalSpacing(0);
        final int screenWidth = this.getWindow().getWindowManager().getDefaultDisplay().getWidth();
        final int margin = 10;
        Log.v(TAG, "Screen width = " + screenWidth);
        gridView.setColumnWidth(screenWidth / 3 - margin * 2 / 3);
        gridView.setStretchMode(GridView.NO_STRETCH);
        gridView.setHorizontalSpacing(margin / 2);
        gridView.setVerticalSpacing(margin / 2);
        final TestGridAdapter adapter = new TestGridAdapter(this, screenWidth / 3 - margin);
        gridView.setAdapter(adapter);
        gridView.setRecyclerListener(adapter);
    } 
} 
6
CodeRank
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) {
6
CodeRank
This code example shows how to use the following methods:setPadding, setFastScrollEnabled, setAdapter, setColumnWidth, setHorizontalSpacing
This code example shows how to use the following methods:setPadding, setFastScrollEnabled, setAdapter, setColumnWidth, setHorizontalSpacing
This code example shows how to use the following methods:setLayoutParams, setPadding, setSelector, setColumnWidth, setGravity
			convertView = ph.rootView;
			convertView.setTag(ph);
		} else { 
			ph = (PageHolder) convertView.getTag();
		} 
		ph.adapter.resetDataForReuse(ph.gridView, provider, pageIndex);
		ph.gridView.setAdapter(ph.adapter);
		perShowGridConfig(ph.gridView, pageIndex);// 用户可以自定义
		return convertView;
	} 
 
	@Override 
	public void onDataChanged(PageDataProvider<T> provider) {
		if (provider != null) {
			perPageItemCount = provider.getDefaultPerPageItemCount();
		} 
	} 
 
	@Override 
	public void onPageRecycle(View page) {

4
CodeRank
This code example shows how to use the following methods:setColumnWidth, setNumColumns
            orientationLandscape(); 
        } 
    } 
 
    private void orientationPortrait() { 
        gridView.setNumColumns(1);
        gridView.setColumnWidth(RelativeLayout.LayoutParams.FILL_PARENT);
    } 
 
    private void orientationLandscape() { 
        gridView.setNumColumns(GridView.AUTO_FIT);
    } 
 
    private void determineOrientation() { 
        if(device.getCurrentOrientation() == Configuration.ORIENTATION_LANDSCAPE){
            orientationLandscape(); 
        } else if(device.getCurrentOrientation() == Configuration.ORIENTATION_PORTRAIT) {
            orientationPortrait(); 
        } 
    } 
4
CodeRank
This code example shows how to use the following methods:setPadding, setFastScrollEnabled, setAdapter, setColumnWidth, setHorizontalSpacing
This code example shows how to use the following methods:setPadding, setFastScrollEnabled, setAdapter, setColumnWidth, setHorizontalSpacing

Related GridView setColumnWidth Questions & Answers:

Other GridView setColumnWidth Examples

51:	
52:			gridView.setNumColumns(AppConstant.NUM_OF_COLUMNS);
53:			gridView.setColumnWidth(columnWidth);
54:			gridView.setStretchMode(GridView.NO_STRETCH);
55:			gridView.setPadding((int) padding, (int) padding, (int) padding,

Read More

setColumnWidth Method Overview
Set the width of columns in the grid.
See Code Examples for other Android GridView Methods: