如何获取屏幕的密度?密度、屏幕

由网友(被神拥护)分享简介:如何获取屏幕密度?我曾尝试与下面code。我得到了密度 1.0 。我改变了我的模拟器 HVGA , QVGA 和 WVGA 仍我收到了同样的结果。 How to get density of a screen? I have tried with the following code. I got density a...

如何获取屏幕密度?我曾尝试与下面code。我得到了密度 1.0 。我改变了我的模拟器 HVGA QVGA WVGA 仍我收到了同样的结果。

How to get density of a screen? I have tried with the following code. I got density as 1.0. I changed my emulator TO HVGA, QVGA and WVGA still I am getting the same result.

int density = getResources().getDisplayMetrics().density;

如何得到我的模拟器的屏幕的实际密度。

How to get actual density of my emulator screen.

推荐答案

请与该code,

DisplayMetrics metrics = new DisplayMetrics();    
getWindowManager().getDefaultDisplay().getMetrics(metrics);    
int screenDensity = metrics.densityDpi;    
阅读全文

相关推荐

最新文章