1 DisplayMetrics dm = new DisplayMetrics(); 2 //获取屏幕信息 3 getWindowManager().getDefaultDisplay().getMetrics(dm); 4 5 int screenWidth = dm.widthPixels; 6 7 int screenHeigh = dm.heightPixels;