title: Custom Widget using LinearLayout not getting onDraw()
body: <p>I'm creating a custom widget by extending <code>LinearLayout</code>:</p>
  
  <pre><code>public class MyWidget extends LinearLayout {
      private static Paint PAINT = new Paint(Paint.ANTI_ALIAS_FLAG);
      static {
          PAINT.setColor(Color.RED);
      }
  
      public MyWidget(Context context) {
          this(context, null);
      }
  
      public MyWidget(Context context, AttributeSet attrs) {
          super(context, attrs);
      }
  
      @Override
      protected void onDraw(Canvas canvas) {
          super.onDraw(canvas);
          canvas.drawCircle(canvas.getWidth() / 2, canvas.getHeight()/2, canvas.getWidth()/2, PAINT);
          // never gets called :-(
      }
  
      @Override
      protected void dispatchDraw(Canvas canvas) {
          super.dispatchDraw(canvas);
          // this gets called, but with a canvas sized after the padding.
      }
  }
  </code></pre>
  
  <p>I can add children just fine, but I'm never getting my custom <code>onDraw()</code> being called. <code>dispatchDraw()</code> gets called, but that seems to have a different canvas (the one that's within the padding. I need to draw on the whole layout area). Is there some flag that needs to get set to get <code>onDraw()</code> called for the layout?</p>