(1)SDK提供的缩放比例,大概是指每厘米长度在实际中的距离。
(2)获取设备的物理尺寸
DisplayMetrics dm = new DisplayMetrics();
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);
Log.d("debug","Screen inches : " + screenInches);(3)dpi是每英寸像素点数
原文:http://nemomojie.blog.51cto.com/5145862/1431738