您的位置:首页 > 移动开发 > Android开发

android:获取屏幕分辨率,屏幕密度

2016-10-17 19:43 183 查看
DisplayMetrics dm = getResources().getDisplayMetrics();

int screenWidth = dm.widthPixels;

int screenHeight = dm.heightPixels;
Log.d("liudezu","==========屏幕分辨率:"+"("+screenWidth+","+screenHeight+")\n");
Log.d("liudezu","==========屏幕密度"+dm.density
+" 屏幕dpi:"+dm.densityDpi);

android.os.Build的一些常使用常量:

 BOARDThe name of the underlying board, like "goldfish".主板名称
BOOTLOADERThe system bootloader version number.系统引导程序版本号
BRANDThe brand (e.g., carrier) the software is customized for, if any.android系统定制商
CPU_ABIThe name of the instruction set (CPU type + ABI convention) of native code.CPU 和ABI的本地代码指令集
 CPU_ABI2The name of the second instruction set (CPU type + ABI convention) of native code.
DEVICEThe name of the industrial design.设备参数
DISPLAYA build ID string meant for displaying to the user显示屏参数
FINGERPRINTA string that uniquely identifies this build.硬件名
HARDWAREThe name of the hardware (from the kernel command line or /proc).内核命令行中的硬件名
HOST 
IDEither a changelist number, or a label like "M4-rc20".修改版本列表
MANUFACTURERThe manufacturer of the product/hardware.硬件厂商
MODELThe end-user-visible name for the end product.版本
PRODUCTThe name of the overall product.手机厂商
RADIOThis field was deprecated in API level 14. The radio firmware version is frequently not available when this class is initialized, leading to a blank or "unknown" value for this
string. Use 
getRadioVersion()
 instead.
SERIALA hardware serial number, if available.
            
   
   
  
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: