Tommy
Tommy

Reputation: 759

Remove image one by one on click

I want to know if it is possible to remove an image when the user clicks a button.

I have three images and each time the user clicks, one image will disappear

If this is possible by removing the image from the id in xml that would be very useful.

Thanks.

Upvotes: 0

Views: 770

Answers (1)

Zsombor Erdődy-Nagy
Zsombor Erdődy-Nagy

Reputation: 16914

How about just hiding an image when the button is clicked? If you only have a few images, and you define them in the xml layout, then that's the easiest way I think.

image.setVisibility(View.GONE);

In case you really want to get rid of the image, I suggest you use some AdapterView class, like GridView or ListView, view the images with those, and handle the deletion in a custom Adapter class.

Upvotes: 1

Related Questions