问题
I am trying to use the SurfaceView and the Canvas to make some draws, in my 480x800 phone, but I do not understand how this is managed, because when I display canvas size, it show 320x533 ( while my screen is 480x800 )
I tryied to use setFixedSize() on the getHolder to reset the canvas resolution, seems to work fine, but is it a correct way to do such resize ?
Another trouble is getting the touch event coordinates, while my canvas seem to be resized, to touch events are still matched against a 320x533 screen, how can I change that ?
回答1:
Your application is running in compatibility mode. You must either target the proper API level or declare in your manifest that you support multiple densities.
来源:https://stackoverflow.com/questions/8013922/size-of-a-canvas-in-a-surfaceview-against-real-screen-resolution