I created CanvasView Object extending View class and I override configChanged in my application's manifest and as you can see, Canvas doesn't redraw again correctly.
- Portrait:
- Landscape
It looks as the rotation doesn't affect the Canvas object.
I've tried invalidting and redrawing again but it doesn't seem to make any difference.
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
super.onSizeChanged(w, h, oldw, oldh);
if(canvasBitmap == null){
canvasBitmap = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888);
}else{
Bitmap temporary = Bitmap.createScaledBitmap(canvasBitmap, w, h, true);
canvasBitmap = temporary;
}
mCanvas = new Canvas(canvasBitmap);
draw(mCanvas);
invalidate();
}
How can I can I keep the Canvas ratio and scaling show it would fit the new size after rotation ?