user1898335
user1898335

Reputation: 11

Is it possible to add the same ImageView multiple times to a screen?

I am using a RelativeLayout for my whole screen. The images on the screen appear and disappear almost randomly, and it often happens that the same image is displayed multiple times. However, when this happens, I get an error saying: "Child already has a parent....".

Do you guys know any way around this? I thought I could probably dynamically change the reference ID for each ImageView that is called onto the screen, but as I will have probably like 50+ imageviews on the screen, dynamically changing positions, disappearing and coming back, wouldn't that slow down the program a lot?

Upvotes: 0

Views: 316

Answers (1)

Ali Dallah
Ali Dallah

Reputation: 51

Each View must have on Parent that when added to it ,it can't be added to another Parent .

if you want you can cache the bitmap some where and apply it to different ImageViews. so both imageviews will have the same bitmap . but you cant have the same ImageView in different Parents .

Upvotes: 4

Related Questions