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) {
 
Experience pair programming with AI  Get Codota for Java