2 Replies - 4466 Views - Last Post: 27 December 2012 - 05:12 PM

#1 lol:  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 25-November 12

Creating image background for Android?

Posted 18 December 2012 - 09:35 AM

I know how to create a background image for an XML layout, but that is not my question. I want to set my own background image for my Graphics class. (I am not using an XML Layout);

			
Canvas canvas=myHolder.lockCanvas();
canvas.drawRGB(02, 02, 150); /*I do not want to use RGB, I want to set my own background image*/
//How can I implement that method?
if(x!=0 && y!=0) {
   canvas.drawBitmap(skull_normal, x-(skull_normal.getWidth()/2), y-(skull_normal.getHeight()/2), null);
}



Is This A Good Question/Topic? 0
  • +

Replies To: Creating image background for Android?

#2 farrell2k  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 797
  • View blog
  • Posts: 2,422
  • Joined: 29-July 11

Re: Creating image background for Android?

Posted 22 December 2012 - 09:44 PM

Unless I am completely misunderstanding you, you can just do what you've done with drawBitmap(). You draw the background image, then whatever you want on top of it...
Was This Post Helpful? 0
  • +
  • -

#3 recheej  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 22
  • Joined: 26-December 12

Re: Creating image background for Android?

Posted 27 December 2012 - 05:12 PM

In your onDraw method try using: this.setBackgroundDrawable
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1