Best code examples for GridView setGravity method (android.widget.GridView.setGravity)

These code examples were ranked by Codota’s semantic indexing as the best open source examples for GridView setGravity method.
You can now enable Codota on your own code to easily search and navigate your Java codebase.

GridView setGravity examples from Open Source projects
This code example shows how to use the following methods: setColumnWidth, setGravity, setNumColumns, setVerticalSpacing, setOverScrollMode
19:	gv.setColumnWidth(200); 
20:	gv.setGravity(Gravity.CENTER); 
21:	gv.setOverScrollMode(View.OVER_SCROLL_ALWAYS); 
22:	gv.setNumColumns(GridView.AUTO_FIT); 
23:	gv.setVerticalSpacing(15); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setGravity, setHorizontalSpacing, setNumColumns, setStretchMode, setVerticalSpacing
74:	mGridView = new GridView(mContext); 
75:	mGridView.setNumColumns(4); 
76:	mGridView.setHorizontalSpacing(10); 
77:	mGridView.setVerticalSpacing(10); 
78:	mGridView.setStretchMode(GridView.STRETCH_COLUMN_WIDTH); 
79:	mGridView.setGravity(Gravity.CENTER); 
80:	mGridView.setOnItemClickListener(this); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setAdapter, setGravity, setNumColumns, setStretchMode, setPadding
157:	gridView = new GridView(mContext); 
-
159:	gridView.setVerticalScrollBarEnabled(false); 
-
161:	gridView.setNumColumns(currentRow.size()); 
162:	gridView.setPadding(1,1,1,1); 
-
164:	gridView.setGravity(Gravity.CENTER); 
165:	gridView.setStretchMode(GridView.STRETCH_COLUMN_WIDTH); 
-
173:	gridView.setAdapter(itemAdapter); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setGravity, setHorizontalSpacing, setNumColumns, setStretchMode, setVerticalSpacing
81:	gvTitle = new GridView(activity); 
82:	gvTitle.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, 
-
84:	gvTitle.setNumColumns(4); 
85:	gvTitle.setStretchMode(GridView.STRETCH_COLUMN_WIDTH); 
86:	gvTitle.setVerticalSpacing(15); 
87:	gvTitle.setHorizontalSpacing(10); 
88:	gvTitle.setPadding(10, 10, 10, 10); 
89:	gvTitle.setGravity(Gravity.CENTER); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: setGravity, setHorizontalSpacing, setNumColumns, setStretchMode, setVerticalSpacing
34:	gridView = new GridView(context); 
35:	gridView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, 
-
37:	gridView.setSelector(new ColorDrawable(Color.TRANSPARENT));// 选中的时候为透明色 
38:	gridView.setNumColumns(bodyAdapter.resID.length); 
39:	gridView.setStretchMode(GridView.STRETCH_COLUMN_WIDTH); 
40:	gridView.setVerticalSpacing(0); 
41:	gridView.setHorizontalSpacing(0); 
42:	gridView.setPadding(0, 0, 0, 0); 
43:	gridView.setGravity(Gravity.CENTER); 
44:	gridView.setOnItemClickListener(bodyClick); 
Full Snippet Info
4
CodeRank
This code example shows how to use the following methods: setColumnWidth, setGravity, setHorizontalSpacing, setNumColumns, setVerticalSpacing
80:	ph.adapter.resetDataForReuse(ph.gridView, provider, pageIndex); 
-
143:	GridView g = new GridView(context); 
-
146:	g.setLayoutParams(lp); 
-
152:	g.setColumnWidth(getColumnWidth()); 
153:	g.setNumColumns(mColumns); 
154:	g.setGravity(Gravity.CENTER); 
155:	g.setVerticalSpacing(mVerticleSpace); 
156:	g.setHorizontalSpacing(mHorizontalSpace); 
-
169:	g.setPadding(left, top, right, bottom); 
-
172:	g.setSelector(android.R.color.transparent); 
Full Snippet Info
4
CodeRank
This code example shows how to use the following methods: setGravity, setHorizontalSpacing, setNumColumns, setStretchMode, setVerticalSpacing
27:	gridView = new GridView(context); 
28:	gridView.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, 
-
30:	gridView.setSelector(new ColorDrawable(Color.TRANSPARENT));// 选中的时候为透明色 
31:	gridView.setNumColumns(4); 
32:	gridView.setStretchMode(GridView.STRETCH_COLUMN_WIDTH); 
33:	gridView.setVerticalSpacing(0); 
34:	gridView.setHorizontalSpacing(0); 
35:	gridView.setPadding(0, 0, 0, 0); 
36:	gridView.setGravity(Gravity.CENTER); 
37:	gridView.setOnItemClickListener(bodyClick); 
Full Snippet Info
4
CodeRank
This code example shows how to use the following methods: setAdapter, setGravity, setHorizontalSpacing, setNumColumns, setStretchMode
31:	gvTitle = new GridView(context); 
32:	gvTitle.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, 
-
34:	gvTitle.setNumColumns(titleAdapter.getCount()); 
35:	gvTitle.setStretchMode(GridView.STRETCH_COLUMN_WIDTH); 
36:	gvTitle.setVerticalSpacing(1); 
37:	gvTitle.setHorizontalSpacing(1); 
38:	gvTitle.setGravity(Gravity.CENTER); 
39:	gvTitle.setOnItemClickListener(titleClick); 
40:	gvTitle.setAdapter(titleAdapter); 
41:	gvTitle.setSelector(new ColorDrawable(Color.TRANSPARENT));// Ñ¡ÖеÄʱºòΪ͸Ã÷É« 
Full Snippet Info
4
CodeRank
This code example shows how to use the following methods: setAdapter, setGravity, setHorizontalSpacing, setNumColumns, setStretchMode
30:	title = new GridView(context); 
31:	title.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT)); 
32:	title.setNumColumns(titleAdapter.getCount()); 
33:	title.setStretchMode(GridView.STRETCH_COLUMN_WIDTH); 
34:	title.setVerticalSpacing(1); 
35:	title.setHorizontalSpacing(1); 
36:	title.setGravity(Gravity.CENTER); 
37:	title.setOnItemClickListener(titleClick); 
38:	title.setAdapter(titleAdapter); 
39:	title.setSelector(new ColorDrawable(Color.TRANSPARENT));//选中的时候为透明色 
Full Snippet Info
4
CodeRank
Related GridView setGravity Questions & Answers:
A view that shows items in two-dimensional scrolling grid. The items in the grid come from the ListAd...
setGravity Method Overview
Set the gravity for this grid.
See Also
  • getAdapter
    Returns the adapter currently associated with this widget.
  • setHorizontalSpacing
    Set the amount of horizontal (x) spacing to place between each item in the grid.
  • setVerticalSpacing
    Set the amount of vertical (y) spacing to place between each item in the grid.