获取屏幕宽高,以像素px为单位 DisplayMetrics dm = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(dm); DEVICE_WIDTH=dm