In API 3.2 when you get the screen height, it seems that return value is the screen height minus the height menu bar. Here is the code:
((WindowManager)mContext.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay().getMetrics(metrics);
int height=met开发者_Python百科rics.heightPixels;
For API 3.2 emulator with 1280x800 screen size, the height return is 752
I tried to get the height with methods but always return 752
Ok I get the answer. In API 3.2 you need to get height and width in onSurfaceChanged method. If you need to get the real values you need to get height and width in portait and landscape mode and select the non reduced measure in both modes.
精彩评论