开发者

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.


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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜