Вопрос

I was having some issues having a view on top of my surface view. I followed the instructions on this answer: https://stackoverflow.com/a/2934759/1315692

That worked great EXCEPT for a view that is custom drawn.

The custom drawn view ALWAYS remains on top. What do I need to do to be able to put a view on top of it? Thanks for any suggestions or insights.

Это было полезно?

Решение

I figured out a solution. It may not be the best solution but it is working for me.

I drew my view that I wanted on top in the draw routine of the object that was stubbornly staying on top USING THE SAME CANVAS. I added a field of type View to my SurfaceView (because that is where the view that remained on top is drawn) with a setter. Then in my draw routine I simply called passedInView.draw(canvas);

If you are at a point where you are not drawing on top of the surface view at all then start with the link from my question. That should be all you need. This is for a situation where a custom drawn view still remains.

Now this can cause some undesired behavior in regards to tapping (you can tap right through your on top view)...so you will need code to handle that but if all else fails, as it had for me, this got my view on top.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top