So, some changes after the question was clarified :)
I suggest you create a bitmap regardless of the view, and then scale it to the same size as the view after creating the view. Create a bitmap of arbitrary size that allows you to display what you want.
// This in some class that renders your bitmap independently, and can be
// queried to get the bitmap ...
Bitmap b = Bitmap.createBitmap (100, 100, Bitmap.Config.ARGB_4444);
// render something to your bitmap here
Then, after your view has been created, take the pre-processed bitmap and resize it to the desired size (I did not actually check this by compiling it - maybe errors):
Rect original = new Rect (0, 0, 100, 100);
RectF destination = new RectF (0.0, 0.0, (float) myView.getWidth (), (float) myView.getHeight ());
Canvas canvas = new Canvas ();
canvas.drawBitmap (myRenderingClass.b, original, destination, null);
myView.draw (canvas);
Tim barrass
source share