title: Drawing multiple rectangles inside linear layout
body: <p>I'm trying to draw multiple rectangles inside of a linear layout which is sitting inside of a scrollview. This is my code for the rectangle view:</p>
  
  <pre><code>private class RectView extends View{
  
      int leftX, rightX, topY, bottomY;
      boolean isAppt;
      private Paint rectPaint;
      private Rect rectangle;
  
      public RectView(Context context, int _leftX, int _rightX, int _topY, int _bottomY, boolean _isAppt){
          super(context);
          leftX = _leftX;
          rightX = _rightX;
          topY = _topY;
          bottomY = _bottomY;
          isAppt = _isAppt;
          init();
      }
  
      private void init(){
  
              rectPaint = new Paint();
  
          if(isAppt){
              rectPaint.setARGB(255, 0, 0, 255);
              rectPaint.setColor(Color.BLUE);
          }
          else{
              rectPaint.setARGB(255, 0, 0, 0);
              rectPaint.setColor(Color.WHITE);
          }
          rectPaint.setStrokeWidth(2);
          rectPaint.setStyle(Style.STROKE);
          rectangle = new Rect(leftX, topY, rightX, bottomY);
  
      }
  
      protected void onDraw(Canvas canvas){
          super.onDraw(canvas);
  
          canvas.drawRect(rectangle, rectPaint);
      }
  
  }
  </code></pre>
  
  <p>And this is how I'm currently trying to display the rectangles:</p>
  
  <pre><code>RectView rv = new RectView(context, 0, 100, 0, 100, true);
  firstDemarc.addView(rv);
  firstDemarc.postInvalidate();
  </code></pre>
  
  <p>firstDemarc is the linear layout inside of my scrollview. Currently I'm not seeing any rectangles. The onDraw function is not being called. How do I properly display the rectangles inside of my scrollview?</p>