I have a drawing app (Android 3.x+ target) that performs a full screen copy of a Bitmap
to the Canvas
in onDraw()
, and I want to ensure I am copying from 32bit to 32bit, per this article. I want to ensure 32bit -> 32bit so that I have the best performance and so I don't have to supply any Paint
to the Canvas.drawBitmap()
operation.
When I create my Bitmap, I ensure that it is done via:
mBitmap = Bitmap.createBitmap(screenWidth, screenHeight, Bitmap.Config.ARGB_8888);
Now, in my drawing Activity, I query the Window via getWindow().getAttributes().format, but am returned OPAQUE (the default value) - question, is this 32bit? In Romain's article above, he mentions that in Android 2.3, windows are now 32bit by default, but a return value of OPAQUE is not so re-assuring.
If someone could clarify what I am seeing here it would be greatly appreciated.
A window is basically like you think of a window on the desktop. It has a single Surface in which the contents of the window is rendered. An application interacts with the Window Manager to create windows; the Window Manager creates a Surface for each window and gives it to the application for drawing.
Simple, use relative layout with the set margin code. Set the margins between each text view, button, etc and it will look the same on every phone. android:layout_marginTop="10dp" // change Top to Bottom, Left or Right for what you need.
You are creating a 32bit-bitmap, but you are not modifying the window-format.
Add a getWindow().setAttributes(attr)
to ensure a full 32bit-compatibility.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With