我们可以DisplayMetrics.densityDpi用来获得设备的近似dpi值,但我很想知道如何获得精确的dpi值?
我想你可以通过课堂DisplayMetrics和领域来访问它densityDpi.
使用DisplayMatrics.xdpi和DisplayMatrics.ydpi
xdpi The exact physical pixels per inch of the screen in the X dimension.
ydpi The exact physical pixels per inch of the screen in the Y dimension.
getResources().getDisplayMetrics().xdpi
getResources().getDisplayMetrics().ydpi
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5391 次 |
| 最近记录: |