title: How can I draw several rectangles in a row programmatically?
body: <p>I want to put several rectangle i a row. But because I'm new to Android and specially to <code>Bitmap, Canvas</code> and so on, I need some help.</p>
  
  <p><strong>It should look like this, only with rectangles:</strong></p>
  
  <p><img src="https://i.stack.imgur.com/hZpDJ.png" alt="enter image description here"></p>
  
  <p><strong>I have created one rectangle with this code:</strong></p>
  
  <pre><code>        Paint paint = new Paint();
          paint.setColor(Color.parseColor("#CD5C5C"));
          Bitmap bg = Bitmap.createBitmap(480, 800, Bitmap.Config.ARGB_8888);
          Canvas canvas = new Canvas(bg); 
          canvas.drawRect(50, 80, 200, 200, paint); 
          RelativeLayout ll = (RelativeLayout) findViewById(R.id.rect);
  
          ImageView iV = new ImageView(this);
          iV.setImageBitmap(bg);
  
          ll.addView(iV);
  </code></pre>
  
  <p>But now I dont know how to create more rectangles with different colors in a row. 
  I'm really new and sorry for that maybe stupid question but I need help for it.</p>
  
  <p>Can anybody guide me how to do this in the best way?</p>