Code example for GridView

Methods: setPaddingsetAdaptersetHorizontalSpacingsetNumColumnssetVerticalSpacing, setOnItemClickListener

0
//		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) {
 
Connect your IDE to all the code out there  Get Codota for Java