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

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

GridView setAdapter examples from Open Source projects
This code example shows how to use the following methods: setAdapter, setVisibility
101:	mGridView.setAdapter(mAdapter); 
-
105:	mGridView.setVisibility(VISIBLE); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setAdapter, setOnItemClickListener, setOnScrollListener
302:	mShelfView.setAdapter(mShelfAdapter); 
303:	mShelfView.setOnScrollListener(mShelfAdapter); 
-
306:	mShelfView.setOnItemClickListener(mOnShelfItemClickListener); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setAdapter, setVisibility
137:	mGrid.setAdapter(mAdapter); 
-
147:	mGrid.setVisibility(empty ? View.GONE : View.VISIBLE); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setAdapter
71:	emotionGrid.setAdapter(adapter); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setAdapter, setNumColumns
41:	grid = new GridView(context); 
-
51:	grid.setNumColumns(columnCount); 
52:	grid.setAdapter(adapter); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setAdapter, setColumnWidth, setHorizontalSpacing, setNumColumns, getLayoutParams
53:	LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams)m_oInfoGrid.getLayoutParams(); 
-
55:	m_oInfoGrid.setLayoutParams(lp); 
-
57:	m_oInfoGrid.setNumColumns(4); 
58:	m_oInfoGrid.setColumnWidth(dm.widthPixels/4); 
59:	m_oInfoGrid.setHorizontalSpacing(10); 
-
66:	m_oInfoGrid.setAdapter(sa); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setAdapter, getSelectedItemId, setEmptyView, setOnItemClickListener
234:	return mGrid.getSelectedItemId(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setAdapter, setColumnWidth, setHorizontalSpacing, setStretchMode, setVerticalSpacing
21:	gridView.setHorizontalSpacing(0); 
-
25:	gridView.setColumnWidth(screenWidth / 3 - margin * 2 / 3); 
26:	gridView.setStretchMode(GridView.NO_STRETCH); 
27:	gridView.setHorizontalSpacing(margin / 2); 
28:	gridView.setVerticalSpacing(margin / 2); 
-
30:	gridView.setAdapter(adapter); 
31:	gridView.setRecyclerListener(adapter); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getAdapter, setAdapter, setOnItemClickListener, setOnScrollListener
106:	if (null == gridView.getAdapter()) { 
107:	gridView.setAdapter(ima); 
-
109:	gridView.setOnScrollListener(new GridScrollListener(ima, icatalog)); 
110:	gridView.setOnItemClickListener(new OnGalleryItemClick(icatalog)); 
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: setAdapter, setColumnWidth, setHorizontalSpacing, setNumColumns, setStretchMode
40:	GridView gridview = new GridView(this); 
41:	gridview.setNumColumns(GridView.AUTO_FIT); 
42:	gridview.setHorizontalSpacing(40); 
43:	gridview.setVerticalSpacing(40); 
44:	gridview.setPadding(20, 20, 20, 0); 
45:	gridview.setFastScrollEnabled(true); 
46:	gridview.setColumnWidth(iconSize); 
47:	gridview.setStretchMode(GridView.STRETCH_COLUMN_WIDTH); 
-
49:	gridview.setAdapter(new ImageAdapter(this, pkgName)); 
50:	gridview.setOnItemClickListener(new AdapterView.OnItemClickListener() { 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: setAdapter, getSelectedItemId, setEmptyView, setOnItemClickListener
239:	return mGrid.getSelectedItemId(); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: setAdapter, setHorizontalSpacing, setNumColumns, setVerticalSpacing, setOnItemClickListener
132:	mGridView = new GridView(this); 
-
134:	mGridView.setAdapter(localMainMenuAdapter); 
135:	mGridView.setNumColumns(COLUMN_SUM); // 设置3列。 
136:	mGridView.setHorizontalSpacing(1);// 横向间隔 
137:	mGridView.setVerticalSpacing(24);// 纵向间隔 
138:	mGridView.setPadding(6, 4, 6, 0);// 设置填充 
139:	mGridView.setOnItemClickListener(this); 
-
141:	this.mScrollLayout.addView(mGridView, mLayoutParams_wrap); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: setAdapter, setSelection, invalidate
106:	menuGrid.setAdapter(getMenuAdapter(menu_name_array2, 
-
114:	menuGrid.invalidate();// ����menu 
115:	menuGrid.setSelection(ITEM_MORE); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: setAdapter, setNumColumns
68:	GridView gridView = new GridView( context ); 
-
70:	gridView.setNumColumns( 4 ); 
71:	IngredientGridViewAdapter adapter = new IngredientGridViewAdapter( handler, relativeLayout, gridView, context, layoutInflater, infos ); 
72:	gridView.setAdapter( adapter ); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setAdapter, setHorizontalSpacing, setNumColumns, setVerticalSpacing, setOnItemClickListener
152:	mGridView = new GridView(this); 
-
154:	mGridView.setAdapter(localMainMenuAdapter); 
155:	mGridView.setNumColumns(COLUMN_SUM); // 设置3列。 
156:	mGridView.setHorizontalSpacing(1);// 横向间隔 
157:	mGridView.setVerticalSpacing(24);// 纵向间隔 
158:	mGridView.setPadding(6, 4, 6, 0);// 设置填充 
159:	mGridView.setOnItemClickListener(this); 
-
161:	this.mScrollLayout.addView(mGridView, mLayoutParams_wrap); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: setAdapter, setHorizontalSpacing, setNumColumns, setVerticalSpacing, setOnItemClickListener
155:	mGridView = new GridView(this); 
-
157:	mGridView.setAdapter(localMainMenuAdapter); 
158:	mGridView.setNumColumns(COLUMN_SUM); // 设置3列。 
159:	mGridView.setHorizontalSpacing(1);// 横向间隔 
160:	mGridView.setVerticalSpacing(24);// 纵向间隔 
161:	mGridView.setPadding(6, 4, 6, 0);// 设置填充 
162:	mGridView.setOnItemClickListener(this); 
-
164:	this.mScrollLayout.addView(mGridView, mLayoutParams_wrap); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: setAdapter, setHorizontalSpacing, setNumColumns, setVerticalSpacing, setOnItemClickListener
169:	mGridView = new GridView(this); 
-
171:	mGridView.setAdapter(localMainMenuAdapter); 
172:	mGridView.setNumColumns(COLUMN_SUM); // 设置3列。 
173:	mGridView.setHorizontalSpacing(1);// 横向间隔 
174:	mGridView.setVerticalSpacing(24);// 纵向间隔 
175:	mGridView.setPadding(6, 4, 6, 0);// 设置填充 
176:	mGridView.setOnItemClickListener(this); 
-
178:	this.mScrollLayout.addView(mGridView, mLayoutParams_wrap); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: setAdapter, setHorizontalSpacing, setNumColumns, setVerticalSpacing, setOnItemClickListener
169:	mGridView = new GridView(this); 
-
171:	mGridView.setAdapter(localMainMenuAdapter); 
172:	mGridView.setNumColumns(COLUMN_SUM); // 设置3列。 
173:	mGridView.setHorizontalSpacing(1);// 横向间隔 
174:	mGridView.setVerticalSpacing(24);// 纵向间隔 
175:	mGridView.setPadding(6, 4, 6, 0);// 设置填充 
176:	mGridView.setOnItemClickListener(this); 
-
178:	this.mScrollLayout.addView(mGridView, mLayoutParams_wrap); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: getAdapter, setAdapter, setNumColumns
116:	grid.setNumColumns(activeQuestion.getColumns()); 
117:	grid.setAdapter(new AnswersAdapter(activeQuestion, this)); 
-
126:	((AnswersAdapter) grid.getAdapter()).setResult(result); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: removeAllViewsInLayout, setAdapter, setNumColumns
51:	mGridView.removeAllViewsInLayout(); 
-
69:	mGridView.setNumColumns(size); 
-
74:	mGridView.setAdapter(adapter); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: setAdapter, setHorizontalSpacing, setNumColumns, setVerticalSpacing, setOnItemClickListener
133:	mGridView = new GridView(this); 
-
136:	mGridView.setAdapter(localMainMenuAdapter); 
137:	mGridView.setNumColumns(COLUMN_SUM); // 设置3列。 
138:	mGridView.setHorizontalSpacing(1);// 横向间隔 
139:	mGridView.setVerticalSpacing(24);// 纵向间隔 
140:	mGridView.setPadding(6, 4, 6, 0);// 设置填充 
141:	mGridView.setOnItemClickListener(this); 
-
143:	this.mScrollLayout.addView(mGridView,mLayoutParams_wrap); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: setAdapter, setOnItemClickListener
35:	gridView.setAdapter(adapter); 
-
37:	gridView.setOnItemClickListener(menuListener); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: setAdapter, setHorizontalSpacing, setVerticalSpacing, setId, setLayoutParams
297:	title_gView.setLayoutParams(params); 
298:	title_gView.setVerticalSpacing(0);// 垂直间隔 
299:	title_gView.setHorizontalSpacing(0);// 水平间隔 
-
301:	title_gView.setAdapter(titleAdapter);// 设置菜单Adapter 
302:	title_gView.setId(caltitleLayoutID); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: setAdapter, setHorizontalSpacing, setNumColumns, setVerticalSpacing, setOnItemClickListener
154:	mGridView = new GridView(this); 
-
156:	mGridView.setAdapter(localMainMenuAdapter); 
157:	mGridView.setNumColumns(COLUMN_SUM); // 设置3列。 
158:	mGridView.setHorizontalSpacing(1);// 横向间隔 
159:	mGridView.setVerticalSpacing(24);// 纵向间隔 
160:	mGridView.setPadding(6, 4, 6, 0);// 设置填充 
161:	mGridView.setOnItemClickListener(this); 
-
163:	this.mScrollLayout.addView(mGridView, mLayoutParams_wrap); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: setAdapter, setHorizontalSpacing, setNumColumns, setVerticalSpacing, setOnItemClickListener
154:	mGridView = new GridView(this); 
-
156:	mGridView.setAdapter(localMainMenuAdapter); 
157:	mGridView.setNumColumns(COLUMN_SUM); // 设置3列。 
158:	mGridView.setHorizontalSpacing(1);// 横向间隔 
159:	mGridView.setVerticalSpacing(24);// 纵向间隔 
160:	mGridView.setPadding(6, 4, 6, 0);// 设置填充 
161:	mGridView.setOnItemClickListener(this); 
-
163:	this.mScrollLayout.addView(mGridView, mLayoutParams_wrap); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: setAdapter, setSelection, getFirstVisiblePosition
81:	int currPostion = mGridView.getFirstVisiblePosition(); 
82:	mGridView.setAdapter(mAdapter); 
83:	mGridView.setSelection(currPostion); //When updating adapter, it wants to scroll to top 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: setAdapter, setSelection, setEmptyView, setOnItemClickListener
193:	mGrid.setAdapter(adapter); 
-
210:	mGrid.setSelection(position); 
-
374:	mGrid.setEmptyView(mEmptyView); 
-
377:	mGrid.setEmptyView(mStandardEmptyView); 
-
381:	mGrid.setOnItemClickListener(mOnClickListener); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: setAdapter, setSelection, invalidate
123:	menuGrid.setAdapter(getMenuAdapter(mContext, 
-
127:	menuGrid.invalidate(); 
128:	menuGrid.setSelection(ITEM_MORE); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: setAdapter, setSelection, invalidate
123:	menuGrid.setAdapter(getMenuAdapter(mContext, 
-
127:	menuGrid.invalidate(); 
128:	menuGrid.setSelection(ITEM_MORE); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: setAdapter, setOnItemClickListener
428:	datesGridView.setAdapter(datesGridAdapter); 
429:	datesGridView.setOnItemClickListener(getDateItemClickListener()); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: setAdapter, setNumColumns
35:	grid.setAdapter(new ArrayAdapter<String>(this, // 
-
41:	grid.setNumColumns(3); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: setAdapter, setOnItemClickListener
51:	gridView.setAdapter(imageViewAdapter); 
52:	gridView.setOnItemClickListener(this); 
Full Snippet Info
4
CodeRank
This code example shows how to use the following methods: setAdapter, setSelection
87:	mGridView.setAdapter(mAdapter); 
88:	mGridView.setSelection(itemPosition); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: getAdapter, setAdapter
51:	booksGrid.setAdapter(adapter); 
-
53:	((BookItemAdapter) booksGrid.getAdapter()).refreshItems(); 
Full Snippet Info
4
CodeRank
This code example shows how to use the following methods: getAdapter, setAdapter
59:	if(null == mImageGrid.getAdapter()) 
60:	mImageGrid.setAdapter(new ImagesAdapter(this, cursor)); 
-
62:	((ImagesAdapter) mImageGrid.getAdapter()).changeCursor(cursor); 
Full Snippet Info
4
CodeRank
This code example shows how to use the following methods: setAdapter, setOnItemClickListener
201:	lv.setAdapter(adapter); 
202:	lv.setOnItemClickListener(new OnItemClickListener() { 
Full Snippet Info
4
CodeRank
Related GridView setAdapter Questions & Answers:
Other GridView setAdapter Examples
40:	
41:			// setting grid view adapter
42:			gridView.setAdapter(adapter);
43:		}
44:

Read More

18:			// Instance of ImageAdapter Class
19:			gridView.setAdapter(new ImageAdapter(this));
20:	
21:			/**
22:			 * On Click event for Single Gridview Item

Read More

18:			// Instance of ImageAdapter Class
19:			gridView.setAdapter(new ImageAdapter(this));
20:		}
21:	}
22:

Read More

4:	
5:	    GridView gridview = (GridView) findViewById(R.id.gridview);
6:	    gridview.setAdapter(new ImageAdapter(this));
7:	
8:	    gridview.setOnItemClickListener(new OnItemClickListener() {

Read More

A view that shows items in two-dimensional scrolling grid. The items in the grid come from the ListAd...
setAdapter Method Overview
Sets the data behind this GridView.
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.