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