Skip to content Skip to sidebar Skip to footer

Dynamic Relative Layout In Android

I am trying to have two images on tp of each other. I can have it work fine with an xml file but I would like to do this dynamically. ctdeasyone is a transparent image. So this wor

Solution 1:

I had to put it in the emulator and play with it for a while until I saw it:

iv.setImageResource(R.drawable.fish2);
(...)
iv.setImageResource(R.drawable.ctdeasytwo);

You're never setting the image resource for iv2!

I changed that and now I see two images as expected.

Solution 2:

This is perfect for FrameLayout . Since you want the images right on top of each other.

Post a Comment for "Dynamic Relative Layout In Android"