If they have the same parent, you should be able to use View.bringToFront() on either ImageView to bring it to the foreground.
change an imageView to foreground and background in Android
-
29-08-2022 - |
Вопрос
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.
Решение
Другие советы
bringToFront(), give this a try :
http://developer.android.com/reference/android/view/View.html#bringToFront%28%29
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