User7723337
User7723337

Reputation: 12018

How to bring ImageView in front of other ImageViews (android)

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.

Upvotes: 1

Views: 7925

Answers (2)

Samuh
Samuh

Reputation: 36484

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.

Upvotes: 1

Hiren Dabhi
Hiren Dabhi

Reputation: 3713

use framelayout(it is like div tag in html)

links: http://developer.android.com/resources/articles/layout-tricks-merge.html http://android-pro.blogspot.com/2010/02/frame-layout.html

Upvotes: 1

Related Questions