Hi,
I'm a beginner when it comes to Android, so bear with me. I have got some code up and running that allows me to draw anywhere I drag my finger and lift. That is running fine. I'm am using a canvas. I want to be able to draw on top of an image though. Do I make an xml layout and reference it in the code. I'm not asking for code, just on ideas on how to do that or some helpful links. Thanks in advance.
Drawing on an Image
Page 1 of 12 Replies - 989 Views - Last Post: 04 February 2011 - 04:38 PM
Replies To: Drawing on an Image
#2
Re: Drawing on an Image
Posted 03 February 2011 - 09:37 AM
what you want to do is when you first initialize your class that has the ondraw method is have a global variable like so : private Bitmap bmp; then in the constructor initialize it like so:
then in your onDraw method do the following:
Hope this helps
.
bmp = BitmapFactory.decodeResource(context.getResources(), R.drawable.<image name>);// note: image must be in one of the drawable folders!
then in your onDraw method do the following:
canvas.drawBitmap(bmp, 0, 0, null);
Hope this helps
#3
Re: Drawing on an Image
Posted 04 February 2011 - 04:38 PM
IT WORKS!!! Thank you. This helps so much.
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote




|