Android Canvas Screen Resolution problem
In my application there is a canvas, when two phones are connected via bluetooth we can share the drawing in real time.
Problem is when phones of different screen size ex: LG Optimus and HTC Incredible S are get connected via bluetooth, The scaling of the canvas goes haywire only a small part of the canvas in HTC is equivalent to the LGs canvas.
This happens only when i use the following in the manifest 开发者_运维知识库file for market compatibility
<uses-sdk android:minSdkVersion="7"></uses-sdk>
If the above is not defined it achieves a proper width size mapping and almost perfect height scaling.
I am not getting why it is happening. IS there any other way we can map the canvas in such a way that we can scale between different screen sizes varying from phones to tablets.
You could use the following:
DisplayMetrics metrics = getBaseContext().getResources().getDisplayMetrics();
int width = metrics.widthPixels;
int height = metrics.heightPixels;
精彩评论