Reputation: 1038
I have a gridView containing 16 children (imageView, 4x4). I have setOnItemClickListener for gridView. What I want is: when the user click on the imageView, its image is gone (I completed it by "setImageResource(android.R.color.transparent)") and it cannot be clicked again.
I have tried imageView.setClickable(false), gridView.getChildAt(position).setClickable(false), but they just didn't work. I could still click on the original box containing the imageView.
I did try another method, which is imageView.setImageBitmap(null), which did enable it to be "unclickable". Yet, when all the imageView in the first row disappear, the second row just replace the first row, shifting the whole gridView upward by a row, which is not what I want. I want them to stay in their position.
Appreciate any help. Thanks in advance.
Below are screenshots when using the method of ImageView.setImageBitmap(null).
Before:
Meanwhile:
After:
Upvotes: 0
Views: 255
Reputation: 1851
What You then can do is to remove the click handler via setOnItemClickListener(null). I always use this because it always workes for me.
Upvotes: 1