How to bring canvas in front of a image view?

Scolioza

Member
Licensed User
Longtime User
Hi everyone.
First of all please excuse my english.

I am trying to make an animation using a png file. In png i have all the frames for animation. Using the canvas with "selRect" and "destRect" i managed to animate the static image. The problem is that when i add a image view with another png loaded as background , the canvas is "sent to back" (the background of image view is always in front). I tried to change the z-order of image view by sending to back without any succes. Is there a way to draw canvas in front of image view?

Thanks in advance for your answers.
 

klaus

Expert
Licensed User
Longtime User
First, to clarify: a Canvas is not a View but a drawing object that refers to a View (Activity, ImageView, Panel etc).

On what view do you draw the animation ?
If you draw it onto the Activity and you add an ImageView this one will aleays be on top of the Activity.
You should either:
- Draw the background on the Activity and the animation on an ImageView.
- Draw the background on one ImageView and the animation on a second ImageView on top of the first one.

You should have a look at chapter 16 Graphics / Drawing in the Beginner's Guide.

Best regards.
 
Upvote 0
Top