How to draw RelativeLayout to canvas?
<p>I want to draw a <code>RelativeLayout</code> with all it's children to <code>Canvas</code>.</p>

<p>This is what I been trying to do:</p>

<pre><code>    // from View constructor
    container = (RelativeLayout) LayoutInflater.from(context).inflate(R.layout.containerLayout, null);

    @Override
    protected void onSizeChanged(int w, int h, int oldw, int oldh) {
        super.onSizeChanged(w, h, oldw, oldh);
        container.layout(0,0, w, h);
    }

    @Override
    protected void onDraw(Canvas canvas) {
        canvas.drawRGB(0, 0, 0);
        container.draw(canvas);
    }
</code></pre>

<p>I debug and saw that <code>onSizeChanged</code> is called with good values. Also this code works for <code>ImageView</code>, so how is <code>RelativeLayout</code> different?</p>

<p>My problem is that it doesn't draw on screen, I don't seen any of its children. How to solve this?</p>