Drawing something on my LinearLayout?
<p>I'm extending LinearLayout:</p>

<pre><code>public class MyLinearLayout extends LinearLayout {
    @Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);

        Paint paint = new Paint();
        paint.setColor(0xFFFF0000);
        canvas.drawLine(0, 0, getWidth(), getHeight(), paint);
    }
}
</code></pre>

<p>If the layout has child elements, shouldn't the red line above be drawn on top of them? Considering a layout like:</p>

<pre><code>&lt;MyLinearLayout&gt;
    &lt;ImageView /&gt;
&lt;/MyLinearLayout&gt;
</code></pre>

<p>I'd expect to get the red line drawn above the child ImageView. But it gets drawn below it. I was assuming all child drawing would have been completed after the super.onDraw() line is finished. </p>

<p>Is there a way to get to the canvas and draw something on it after all child drawing has been completed?</p>

<p>Thanks</p>
