/** * 获取屏幕物理尺寸 * @return */private double getScreenSize(){ DisplayMetrics dm = new DisplayMetrics(); ((Activity)getContext()).getWindowManager().getDefaultDisplay().getMetrics(dm); double x = Math.pow(dm.widthPixels/dm.xdpi, 2); double y = Math.pow(dm.heightPixels/dm.ydpi, 2); double screenInches = Math.sqrt(x+y); return screenInches;}
时间: 2024-12-28 00:02:42