If you want the the display dimensions in pixels you can use getSize: Display display = getWindowManager().getDefaultDisplay(); Point size = new Point(); display.getSize(size); int width = size.x; int height = size.y; If you're not in an Activity you…
方法一: public static int SCREEN_WIDTH; public static int SCREEN_HEIGHT; //获取屏幕 WindowManager wm = (WindowManager) getBaseContext().getSystemService( Context.WINDOW_SERVICE); Display display = wm.getDefaultDisplay(); Point size = new Point(); display.ge…