I'm developing a sample game using GridView
. Sometimes i want to add my ArrayOfPicture and ArrayOfNumber together. That's mean a number must be stay inside a picture from the user's view. So how can i stack them together? This is my example code:
private Integer image_id[] = {R.drawable.cl1,
R.drawable.cl2,
R.drawable.cl1,
R.drawable.cl2}
private Integer number_id[] = {R.drawable.num1,
R.drawable.num2,
R.drawable.num3}
And this is the view that only show a list of background without number inside:
@Override
public View getView(int arg0, View arg1, ViewGroup arg2) {
ImageView img;
if(arg1 == null)
{
img = new ImageView(CTX);
img.setLayoutParams(new GridView.LayoutParams(200,200));
img.setScaleType(ImageView.ScaleType.CENTER_CROP);
img.setPadding(8, 8, 8, 8);
}
else
{
img = (ImageView) arg1;
}
img.setImageResource(getImages());
return img;
// TODO Auto-generated method stub
// return null;
}
Aucun commentaire:
Enregistrer un commentaire