I have list of images added in a LinearLayout
+------------+
| Image 1 |
+------------+
| Image 2 |
+------------+
| Image 3 |
+------------+
I want every 2nd image to get Displayed above 1st and 3rd Image.
For that I have set Bottom Margin of Image 1 to -10 pixels so Image 2 overrides Image 1 and it works, but this same logic does not work for Image 3, Image 2 does not override Image 3s Top portion, as i have given -10 top margin for the Image 3.
I have also tried bring_to_front for Image 2 but it does not work.
How Should i get it working.
Thanks,
PP.
FrameLayout will be an ideal choice for such a case. It allows z-ordering of child views and will stack all the view over one another. Using
view#setVisibility(...)you can toggle visibility of your views to get the desired effect.