Code example for GridView

Methods: setLayoutParamssetSelectorsetAdaptersetGravitysetHorizontalSpacingsetNumColumnssetStretchModesetVerticalSpacing, setOnItemClickListener

0
		super(context);
 
		mLayout = new LinearLayout(context);
		mLayout.setOrientation(LinearLayout.VERTICAL);
		// ±êÌâÑ¡ÏîÀ¸ 
		gvTitle = new GridView(context);
		gvTitle.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,
				LayoutParams.WRAP_CONTENT));
		gvTitle.setNumColumns(titleAdapter.getCount());
		gvTitle.setStretchMode(GridView.STRETCH_COLUMN_WIDTH);
		gvTitle.setVerticalSpacing(1);
		gvTitle.setHorizontalSpacing(1);
		gvTitle.setGravity(Gravity.CENTER);
		gvTitle.setOnItemClickListener(titleClick);
		gvTitle.setAdapter(titleAdapter);
		gvTitle.setSelector(new ColorDrawable(Color.TRANSPARENT));// Ñ¡ÖеÄʱºòΪ͸Ã÷É«
		this.titleAdapter = titleAdapter;
		// ×ÓÑ¡ÏîÀ¸ 
		gvBody = new GridView(context);
		gvBody.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,
				LayoutParams.WRAP_CONTENT));
Stop searching for code, let great code find you!  Add Codota to your java IDE