Android 获取屏幕尺寸的三种方法
方法1:
DisplayMetrics dm = _context.getResources().getDisplayMetrics();
int height = dm.heightPixels;
int width = dm.widthPixels;
方法2:
Display display = this.getWindowManager().getDefaultDisplay()
int width = display.getWidth();
int height = display.getHeight();
方法3:
DisplayMetrics metrics = new DisplayMetrics();
Display display = this.getWindowManager().getDefaultDisplay().getMetrics(metrics);
int width = metrics.widthPixels;
int height = metrics.heightPixels;