如何知道设备的密度?密度、设备

由网友(无人问及殇情)分享简介:喜因为我们可以在Android上的分辨率,但怎么才能知道设备(屏幕)的密度?hias we can get the resolution in android but how can we know the density of the device(screen)?thnakx 推荐答案执行以下code:...

喜 因为我们可以在Android上的分辨率,但怎么才能知道设备(屏幕)的密度?

hi as we can get the resolution in android but how can we know the density of the device(screen)?

thnakx

推荐答案

执行以下code:

float scale = getApplicationContext().getResources().getDisplayMetrics().density;

和检查的值扩展

0.75 手段的低密度的 1.0 手段的标准(中)密度的 1.5 手段的高(大)密度的 2.0 手段的超高密度的 0.75 means low density 1.0 means standard (medium) density 1.5 means high (large) density 2.0 means extra high density
阅读全文

相关推荐

最新文章