Getting the bounds when drawing on the canvas in android
<p>I am drawing a Drawable to a custom view in android.</p>

<p>When the custom view is displayed the parent is a ScrollView. When the scrollview moves the Drawables shrink until they get off screen and then get bigger as you scroll back to the custom widget even though its explicitly set at 219dip square.</p>

<p>The reason seems to be the way I'm getting the bounds in the onDraw(Canvas canvas) method</p>

<pre><code>    int mRight;
    int mLeft;
    int mBottom;
    int mTop;

    mRight = canvas.getClipBounds().right; 
    mLeft = canvas.getClipBounds().left;
    mBottom = canvas.getClipBounds().bottom;
    mTop = canvas.getClipBounds().top;

    int availableWidth = mRight - mLeft;
    int availableHeight = mBottom - mTop;
</code></pre>

<p>It seems that the ClipBound changes to reflect how much of the view is on the screen. Therefore resize the Drawables until it gets really small and goes off screen. </p>

<p>I tried to replace the code above with this</p>

<pre><code>    int availableWidth = canvas.getWidth();
    int availableHeight = canvas.getHeight();
</code></pre>

<p>Nothing is drawn to the screen now? shouldn't this work? </p>
