//屏幕宽高分辨率
WindowManager wm =(WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
Display display = wm.getDefaultDisplay();
DisplayMetrics metrics = new DisplayMetrics();
display.getRealMetrics(metrics);
int widthPixels = metrics.widthPixels;//获取屏幕宽
int heightPixels = metrics.heightPixels;//获取屏幕高(包含虚拟键)