Imageview vs. Canvas

bryon

Member
Licensed User
Longtime User
Hi everybody,

I'm new to B4A and have a couple of questions I haven't been able to find the answers to in the forums. I'm confused about the appropriate time to use imageviews versus the canvas.

For instance, I am trying to build a side scroller game and have loaded a bitmap into an imageview that is twice the width of my screen. I am then moving the imageview back and forth to show the movement. Should I be doing this with a canvas instead?

What about overlaying another imageview on top to move independently? How can I set transparencies?

I'm trying to do as much on my own right now to try and learn this stuff, but this has me kind of confused.

Any help would be appreciated.

Thank you!
 

klaus

Expert
Licensed User
Longtime User
You can use ImageViews or Panels and draw on either of them with a Canvas.
To set a view transparent, draw a rectangle with a transparent color on it.
If you have a bitmap with transparent areas you can copy those with the canvas.

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

Best regards.
 
Upvote 0

bryon

Member
Licensed User
Longtime User
Ok, I think I got it. So like a VB6 Form, where you can add a picturebox control and have that picturebox load a bitmap, in B4A you load a bitmap to a Imageview or Panel and then add tha Imageview or Panel to a Canvas?

Thanks for your help!
 
Upvote 0
Top