获取屏幕宽度
private static int getScreenWidth() {
WindowManager manager =
(WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
Display display = manager.getDefaultDisplay();
return display.getWidth();
}
获取屏幕高度
private int getScreenHeight() {
WindowManager wm = (WindowManager) getSystemService(Context.WINDOW_SERVICE);
Display display = wm.getDefaultDisplay();
return display.getHeight();
}