Android Question canvas draw dissapear when passing over an image

tufanv

Expert
Licensed User
Longtime User
Hello

I am drawing circles behind my moving object with canvas. I dont have any problem with that . I initialized the canvas on mainpanel and the image is also a child of mainpanel. When my object is moving over the image , object is visible no problems but canvas drawen circles get lost until it moves out of image boundaries. I try to send the image back with sendtoback but that does not work.
How can i fix this ?

TY
 

JordiCP

Expert
Licensed User
Longtime User
One possible option (if I understood it right) is:

mainPanel
--> imageview (a Panel child, as you have it now, with your moving image)
--> imageview2 (also as a Panel child, with the same dimensions as the panel, transparent color.)
and then
Canvas.initialize(imageview2) 'instead of initializing the canvas to the Panel. Now it will always be on top :)
 
Upvote 0

sorex

Expert
Licensed User
Longtime User
how many moving circles will you have?

if it ain't too much you could just create imageviews where you draw once the circle on and move those around instead of constantly redrawing them.
 
Upvote 0

tufanv

Expert
Licensed User
Longtime User
I changed the image file so it is very thin and does not block my circles now. I will have too many circles so other solutions will not be so easy. Solved it for now . Thanks for help.
 
Upvote 0
Top