WindowManager wm = getWindowManager(); Point point = new Point(); wm.getDefaultDisplay().getSize(point); int width = point.x; int height = point.y;
在sdk版本13以前可使用:java
WindowManager wm = getWindowManager(); int width = wm.getDefaultDisplay().getWidth(); int height = wm.getDefaultDisplay().getHeight();