获取屏幕参数的两种方法(宽,高,密度等)
方法二:
DisplayMetrics dm = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(dm);
Int nowWidth = dm.widthPixels; //当前屏幕像素
int nowHeigth = dm.heightPixels; //当前屏幕像素
Int density=dim.density;//屏幕的密度density
Log.e("密度:",density+"");
int width = (int) (nowWidth * density);
int height = (int) (nowHeigth * density);