In order to set color in grid cell while inflating grid cell's layout, in your baseadapter class create a cell's array then set the color as you wish.
Like
LayoutInflater li = (LayoutInflater) mContext
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
grd = li.inflate(R.layout.grid_item, null);
FrameLayout dgcl = (FrameLayout) grd.findViewById(R.id.grditm);
parent_l[position] = dgcl;
then
parent_l[21].setBackgroundColor(Color.RED);
here griditm is the id of the layout grid_item
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…