我已经创建了一个函数来根据分辨率和像素密度计算对角线屏幕尺寸。 viz-设备的物理密度和物理密度之间的差异究竟是什么?
def find_display_size(d):
width=float(720);
height=float(1280);
dens=float(294);
wi=float(width)/(dens);
hi=float(height)/(dens);
x = math.pow(wi,2);
y = math.pow(hi,2);
screenInches = math.sqrt(x+y);
diagScreenSizeRoundedoff = round(screenInches)
logger.info("screenInches "+str(screenInches),also_console=True)
logger.info("diagScreenSizeRoundedoff"+str(diagScreenSizeRoundedoff),also_console=True)
我想用ADB shell来获取信息(分辨率&像素密度)。 当我试图我正在此命令 -
$adb shell wm density
Result-
Physical density: 320
结果是一个设备(= 320)的物理密度,然而,特定装置的像素密度(〜294)。很想知道这两者之间究竟有什么区别,以及我如何使用adb命令来查找像素密度,在这种情况下,该命令大约是294。
的PS我的是 - MOTO XT1068
我不相信有一种方法可以持续获得实际的物理密度。请参阅评论:http://stackoverflow.com/questions/2193457/is-there-a-way-to-determine-android-physical-screen-height-in-cm-or-inches –
实际上有一种方法。点击此处查看 - http://kingscalculator.com/en/other-calculators/pixel-density-calculator。但在我的情况下,我需要计算,对角线屏幕大小,这反过来又需要像素密度。 –