문제

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