GridView setHorizontalSpacing - 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 setHorizontalSpacing 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
Experience pair programming with AI  Get Codota for Java
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
Experience pair programming with AI  Get Codota for Java
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++) {            
6
CodeRank
Experience pair programming with AI  Get Codota for Java
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, setAdapter, setHorizontalSpacing, setNumColumns, setVerticalSpacing
 
		// FrameLayout mFrameLayout = new FrameLayout(this); 
		LayoutParams mLayoutParams_wrap = new LayoutParams(153, 140);
		// mFrameLayout.setLayoutParams(mLayoutParams); 
 
		mGridView = new GridView(this);
		localMainMenuAdapter = new MainMenuAdapter2(this, mList);
		mGridView.setAdapter(localMainMenuAdapter);
		mGridView.setNumColumns(COLUMN_SUM); // 设置3列。
		mGridView.setHorizontalSpacing(1);// 横向间隔
		mGridView.setVerticalSpacing(24);// 纵向间隔
		mGridView.setPadding(6, 4, 6, 0);// 设置填充
		mGridView.setOnItemClickListener(this);
		// mFrameLayout.addView(mGridView, mLayoutParams_wrap); 
		this.mScrollLayout.addView(mGridView, mLayoutParams_wrap);
	} 
 
	@Override 
	public void OnViewChange(int index) {
 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:setPadding, setAdapter, setHorizontalSpacing, setNumColumns, setVerticalSpacing
 
		// FrameLayout mFrameLayout = new FrameLayout(this); 
		LayoutParams mLayoutParams_wrap = new LayoutParams(153, 140);
		// mFrameLayout.setLayoutParams(mLayoutParams); 
 
		mGridView = new GridView(this);
		localMainMenuAdapter = new MainMenuAdapter2(this, mList);
		mGridView.setAdapter(localMainMenuAdapter);
		mGridView.setNumColumns(COLUMN_SUM); // 设置3列。
		mGridView.setHorizontalSpacing(1);// 横向间隔
		mGridView.setVerticalSpacing(24);// 纵向间隔
		mGridView.setPadding(6, 4, 6, 0);// 设置填充
		mGridView.setOnItemClickListener(this);
		// mFrameLayout.addView(mGridView, mLayoutParams_wrap); 
		this.mScrollLayout.addView(mGridView, mLayoutParams_wrap);
	} 
 
	@Override 
	public void OnViewChange(int index) {
 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:setPadding, setAdapter, setHorizontalSpacing, setNumColumns, setVerticalSpacing
 
		// FrameLayout mFrameLayout = new FrameLayout(this); 
		LayoutParams mLayoutParams_wrap = new LayoutParams(153, 140);
		// mFrameLayout.setLayoutParams(mLayoutParams); 
 
		mGridView = new GridView(this);
		localMainMenuAdapter = new MainMenuAdapter2(this, mList);
		mGridView.setAdapter(localMainMenuAdapter);
		mGridView.setNumColumns(COLUMN_SUM); // 设置3列。
		mGridView.setHorizontalSpacing(1);// 横向间隔
		mGridView.setVerticalSpacing(24);// 纵向间隔
		mGridView.setPadding(6, 4, 6, 0);// 设置填充
		mGridView.setOnItemClickListener(this);
		// mFrameLayout.addView(mGridView, mLayoutParams_wrap); 
		this.mScrollLayout.addView(mGridView, mLayoutParams_wrap);
	} 
 
	@Override 
	public void OnViewChange(int index) {
 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:setLayoutParams, setPadding, setGravity, setHorizontalSpacing, setNumColumns
This code example shows how to use the following methods:setPadding, setAdapter, setHorizontalSpacing, setNumColumns, setVerticalSpacing
		// FrameLayout mFrameLayout = new FrameLayout(this); 
		LayoutParams mLayoutParams = new LayoutParams(-1, -1);
		LayoutParams mLayoutParams_wrap = new LayoutParams(153, 140);
		// mFrameLayout.setLayoutParams(mLayoutParams); 
 
		mGridView = new GridView(this);
		localMainMenuAdapter = new MainMenuAdapter2(this, mList);
		mGridView.setAdapter(localMainMenuAdapter);
		mGridView.setNumColumns(COLUMN_SUM); // 设置3列。
		mGridView.setHorizontalSpacing(1);// 横向间隔
		mGridView.setVerticalSpacing(24);// 纵向间隔
		mGridView.setPadding(6, 4, 6, 0);// 设置填充
		mGridView.setOnItemClickListener(this);
		// mFrameLayout.addView(mGridView, mLayoutParams_wrap); 
		this.mScrollLayout.addView(mGridView, mLayoutParams_wrap);
	} 
 
	@Override 
	public void OnViewChange(int index) {
 
5
CodeRank
Experience pair programming with AI  Get Codota for Java

Related GridView setHorizontalSpacing Questions & Answers:

Other GridView setHorizontalSpacing Examples

55:			gridView.setPadding((int) padding, (int) padding, (int) padding,
56:					(int) padding);
57:			gridView.setHorizontalSpacing((int) padding);
58:			gridView.setVerticalSpacing((int) padding);
59:		}

Read More

setHorizontalSpacing Method Overview
Set the amount of horizontal (x) spacing to place between each item in the grid.
See Code Examples for other Android GridView Methods: