1.方法一
Display display = getWindowManager().getDefaultDisplay();
Config.screenWidth = display.getWidth();
Config.screenHeight = display.getHeight();
Config.screenWidth = display.getWidth();
Config.screenHeight = display.getHeight();
2. 方法二:
DisplayMetrics metrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(metrics);
int screenWidth = metrics.widthPixels;
int screenHeight = metrics.heightPixels;
getWindowManager().getDefaultDisplay().getMetrics(metrics);
int screenWidth = metrics.widthPixels;
int screenHeight = metrics.heightPixels;
做个快乐的自己。