Android 获取设备的物理尺寸
来源:互联网 发布:mac itunes不显示铃声 编辑:程序博客网 时间:2024/05/22 15:28
从一个外国的帖子上找到的答案http://stackoverflow.com/questions/2193457/is-there-a-way-to-determine-android-physical-screen-height-in-cm-or-inches
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);
还有一段:
According to the documentation:
The logical density of the display. This is a scaling factor for the Density Independent Pixel unit, where one DIP is one pixel on an approximately 160 dpi screen (for example a 240x320, 1.5"x2" screen), providing the baseline of the system's display. Thus on a 160dpi screen this density value will be 1; on a 120 dpi screen it would be .75; etc.
This value does not exactly follow the real screen size (as given by xdpi and ydpi, but rather is used to scale the size of the overall UI in steps based on gross changes in the display dpi. For example, a 240x320 screen will have a density of 1 even if its width is 1.8", 1.3", etc. However, if the screen resolution is increased to 320x480 but the screen size remained 1.5"x2" then the density would be increased (probably to 1.5).
- Android 获取设备的物理尺寸
- Android 获取设备的物理尺寸
- Android 获取设备的物理尺寸
- android获取屏幕的物理尺寸
- Android设备屏幕尺寸以及物理密度的计算
- 获取Android手机或Pad的屏幕的物理尺寸
- Android中获取屏幕物理尺寸的方法
- Android获取当前设备屏幕信息(分辨率,密度以及物理尺寸)
- android 获取设备屏幕尺寸
- android设备的尺寸
- Android 获取屏幕尺寸(设备对角线的英寸数)
- android 获取设备屏幕尺寸、高度、宽度
- Android计算手机真正的物理尺寸
- Android 设备获取物理唯一标识码
- 显示器物理尺寸的获取,EDID数据获取
- android获取手机屏幕的尺寸
- Android常见尺寸的获取
- Android系统版本以及屏幕相关参数的获取包括长宽,物理尺寸,px,dp,dpi,ppi等,
- Android应用开发之视频播放器
- 调查服务器响应时间的利器 tcprstat
- C++ Primer 4 第十二章 类
- Android 对话框 (AlertDialog & ProgressDialog)
- 基于新浪开放平台的企业微博影响力分析应用的学习笔记。
- Android 获取设备的物理尺寸
- GoAhead WebServer URL Handlers
- Spring如何查找XSD?
- 网络安全选项的调整
- Android Intent介绍
- C++ primer 4 第十三章 复制控制
- GoForms
- C++ Primer 4 第十四章 重载操作符与转换
- net中System.Diagnostics.Process.Start用法