title: drawing in canvas using canvas width and height
body: <p>I'm trying to draw 3 rows of barrels with 4 barrels each row. In order for it to fit all screens I'm using canvas' height and width. this is my code:</p>
  
  <pre><code>int width = canvas.getWidth();
  int height=canvas.getHeight();
  int x = 20, y = 20, count = 0;
  for (int i = 0; i &lt; 3; i++) {
      for (int j = 0; j &lt; 4; j++) {
          canvas.drawBitmap(BarrelSprite, width*(x/100), height*(y/100), null);
          rect[count] = new Rect( width*(x/100), height*(y/100),  width*(x/100) + BarrelSprite.getWidth(), height*(y/100) + BarrelSprite.getHeight());
          count++;
          x += 20;
      }
  y += 20;
  x = 20;
  </code></pre>
  
  <p>when I run it all the barrels seems to stack at the top left corner for some reason. I wanted to draw every barrel's X in the first 20% of the screen, 40%,60% etc. same for Y value.</p>