How to place a layout on top of layout.setZOrderOnTop ()

I have a SurfaceView for a book for pagecurl. I wanted it to be transparent for some reason, and I used

myView.setZOrderOnTop() 

to achieve this. Everything is working fine so far.

Now I need to put some views (suppose ImageView) on top of this review (book). When I do this, the image is hidden behind the book. Part of it, which is outside the bounds of the book, is visible as expected. I added the image in the last of the XML, but did not find a way to change the z-image of the image so that it becomes visible in the book.

Please suggest me a way to achieve this.

NOTE. I cannot remove setZOrderOnTop () unless there is another solution to make the image on the surface transparent.

+4
source share
1 answer

I don’t know your code, but I hope it helps you:

 view1.setZOrderOnTop(false); view2.setZOrderOnTop(true); view2.setZOrderMediaOverlay(true); 

In my case:

enter image description here

Try playing with this,

see link setZOrderMediaOverlay here

+5
source

Source: https://habr.com/ru/post/1501826/


All Articles