Android - overlay small check icon over specific image in gridview or change border
Posted
by
oscar
on Stack Overflow
See other posts from Stack Overflow
or by oscar
Published on 2012-06-16T18:31:31Z
Indexed on
2012/06/16
21:16 UTC
Read the original article
Hit count: 271
I've just asked a question about an hour ago, while waiting for replies, I've thought maybe I can achieve what I want differently. I was thinking of changing the image but it would be better if I could perhaps overlay something over the top of complete levels in the gridview i.e a small tick icon At the moment, when a level has been completed I am storing that with sharedpreferences
So I have a gridView layout to display images that represent levels. Let's just say for this example I have 20 levels. When one level is complete is it possible to overlay the tick icon or somehow highlight the level image. Maybe change the border of the image??
Here are the image arrays I use
int[] imageIDs = {
R.drawable.one,
R.drawable.two,
R.drawable.three,
R.drawable.four,
R.drawable.five,
R.drawable.six
etc.......
and then I have my code to set the images in gridView. Obviously there is more code in between.
public View getView(int position, View convertView, ViewGroup parent)
{
ImageView imageView;
if (convertView == null) {
imageView = new ImageView(context);
imageView.setLayoutParams(new GridView.LayoutParams(140, 140));
imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
imageView.setPadding(5, 5, 5, 5);
} else {
imageView = (ImageView) convertView;
}
imageView.setImageResource(imageIDs[position]);
return imageView;
would it be possible to do any of the above, even the border method would be fine. Thanks for any help
© Stack Overflow or respective owner