方法一
WindowManager managet=(WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
Display display=managet.getDefaultDisplay();
windowX=display.getWidth();
windowY=display.getHeight();
方法二
WindowManager managet=(WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
DisplayMetrics dm=new DisplayMetrics();
managet.getDefaultDisplay().getMetrics(dm);
windowX=dm.widthPixels;
windowY=dm.heightPixels;