I have two ImageViews imageView1, imageView2 and they are partially intersected, I want with an OnClick or onTouch on one of theme it will be on foreground and the other one at the background relative to the other one and vice versa.

I just need the function like setOnForeGround (which does not exist) to call it for this raison.

Thanks.

有帮助吗?

解决方案

If they have the same parent, you should be able to use View.bringToFront() on either ImageView to bring it to the foreground.

其他提示

Ok Here is trick to do that, First create a FrameLayout and put images into that in order for four images like

1) image1 
2) image2

3) image2
4) image1

By default the visibity of 3) and 4) will be hidden. 1) and 2) is visible. When user click 2) : make 1) and 2) hidden and show 3) and 4).

Then in similar way if user clicks 4): hide 3) and 4) and show 1) and 2). Hope this will help.

using View.bringToFront() can be useful for you

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top